Heap Sort in C#

Ankith Reddy
Updated on 26-Jun-2020 14:27:51

3K+ Views

Heap Sort is a sorting algorithm that makes use of the heap data structure. Each time the root element of the heap i.e. the largest element is removed and stored in an array. It is replaced by the rightmost leaf element and then the heap is reestablished. This is done until there are no more elements left in the heap and the array is sorted.A program that demonstrates heap sort in C# is given as follows.Example Live Demousing System; namespace HeapSortDemo {    public class example {       static void heapSort(int[] arr, int n) {         ... Read More

Difference Between White Box, Black Box, and Gray Box Testing

siddhartha kotamraju
Updated on 26-Jun-2020 14:26:38

1K+ Views

When you develop a web application, before hosting to the web, testing is very important to prevent the hackers. There are three types of tests, Black, gray and white box tests which are conducted to ensure that an attacker cannot reach your application code.White Box (or glass box) testingWhite Box (or glass box) testing is the process of giving input code to the system and checking how the system processes it how the output is generated using that code. This is the test where the team tests the internal logic of the code written.It is the process of checking how ... Read More

Microprocessor 8085 Architecture

Arjun Thakur
Updated on 26-Jun-2020 14:25:12

3K+ Views

Microprocessor 8085 Architecture which is shown in the below figure consists of various units and each unit has its respective functionality.Fig: 8085 Microprocessor ArchitectureThese units are listed below-AccumulatorIn Intel 8085microprocessor, accumulator acts an 8-bit register to store 8-bit data to perform arithmetic and logical operation on them. The final result stored in the accumulator. It is also called A register.Arithmetic Logic Unit (ALU)It basically performs 8-bit arithmetic operations like +, -, *, / and to perform logical operations like AND, OR, NOT etc. ALU gets inputs from the accumulator and temporary register on which it performs such operations. After processing ... Read More

Get Default SIM Operator ID in Android

Chandu yadav
Updated on 26-Jun-2020 14:16:18

537 Views

This example demonstrate about How to get default Sim Operator id in android.Step 1 − Create a new project in Android Studio, go to File ⇒ New Project and fill all required details to create a new project.Step 2 − Add the following code to res/layout/activity_main.xml.     In the above code, we have taken a text view to show device sim operator id.Step 3 − Add the following code to java/MainActivity.xmlpackage com.example.myapplication; import android.Manifest; import android.content.Context; import android.content.pm.PackageManager; import android.os.Build; import android.os.Bundle; import android.support.annotation.NonNull; import android.support.annotation.RequiresApi; import android.support.v4.app.ActivityCompat; import android.support.v7.app.AppCompatActivity; import android.telephony.TelephonyManager; import android.widget.TextView; import static ... Read More

Get Default Phone Subscriber ID in Android

Arjun Thakur
Updated on 26-Jun-2020 14:15:07

945 Views

This example demonstrate about How to get default phone Subscriber Id in android.Step 1 − Create a new project in Android Studio, go to File ⇒ New Project and fill all required details to create a new project.Step 2 − Add the following code to res/layout/activity_main.xml.     In the above code, we have taken a text view to show phone subscriber id.Step 3 − Add the following code to java/MainActivity.xmlpackage com.example.myapplication; import android.Manifest; import android.content.Context; import android.content.pm.PackageManager; import android.os.Build; import android.os.Bundle; import android.support.annotation.NonNull; import android.support.annotation.RequiresApi; import android.support.v4.app.ActivityCompat; import android.support.v7.app.AppCompatActivity; import android.telephony.TelephonyManager; import android.widget.TextView; import static android.Manifest.permission.READ_PHONE_NUMBERS; ... Read More

Pass 2D Array as a Parameter in C

George John
Updated on 26-Jun-2020 14:14:28

1K+ Views

A 2-D array can be easily passed as a parameter to a function in C. A program that demonstrates this when both the array dimensions are specified globally is given as follows.Example Live Demo#include const int R = 4; const int C = 3; void func(int a[R][C]) {    int i, j;    for (i = 0; i < R; i++)    for (j = 0; j < C; j++)    a[i][j] += 5; ; } int main() {    int a[R][C];    int i, j;    for (i = 0; i < R; i++)    for (j = 0; ... Read More

Get Default Phone Number in Android

Ankith Reddy
Updated on 26-Jun-2020 14:14:11

658 Views

This example demonstrate about How to get default phone number in android.Step 1 − Create a new project in Android Studio, go to File ⇒ New Project and fill all required details to create a new project.Step 2 − Add the following code to res/layout/activity_main.xml.     In the above code, we have taken a text view to show the phone number.Step 3 − Add the following code to java/MainActivity.xmlpackage com.example.myapplication; import android.Manifest; import android.content.Context; import android.content.pm.PackageManager; import android.os.Bundle; import android.support.annotation.NonNull; import android.support.v4.app.ActivityCompat; import android.support.v7.app.AppCompatActivity; import android.telephony.TelephonyManager; import android.widget.TextView; import static android.Manifest.permission.READ_PHONE_NUMBERS; import static android.Manifest.permission.READ_PHONE_STATE; import static ... Read More

Return Local Array from a C++ Function

Ankith Reddy
Updated on 26-Jun-2020 14:13:36

855 Views

A local array cannot be directly returned from a C++ function as it may not exist in memory after the function call. A way to resolve this is to use a static array in the function. As the lifetime of the static array is the whole program, it can easily be returned from a C++ function without the above problem.A program that demonstrates this is given as follows.Example Live Demo#include using namespace std; int *retArray() {    static int arr[10];    for(int i = 0; i

Get Default Phone Network Specifier in Android

George John
Updated on 26-Jun-2020 14:13:26

260 Views

This example demonstrate about How to get default phone Network Specifier in android.Step 1 − Create a new project in Android Studio, go to File ⇒ New Project and fill all required details to create a new project.Step 2 − Add the following code to res/layout/activity_main.xml.     In the above code, we have taken a text view to show phone network specifier.Step 3 − Add the following code to java/MainActivity.xmlpackage com.example.myapplication; import android.Manifest; import android.content.Context; import android.content.pm.PackageManager; import android.os.Build; import android.os.Bundle; import android.support.annotation.NonNull; import android.support.annotation.RequiresApi; import android.support.v4.app.ActivityCompat; import android.support.v7.app.AppCompatActivity; import android.telephony.TelephonyManager; import android.widget.TextView; import static android.Manifest.permission.READ_PHONE_NUMBERS; import ... Read More

Initializing Array with Variable vs Real Number in C++

Arjun Thakur
Updated on 26-Jun-2020 14:12:22

338 Views

An array is a collection of same type of elements at contiguous memory location. The lowest address in the array corresponds to the first element while highest address corresponds to the last element. The array index starts with zero(0) and ends with the size of array minus one(array size - 1).An array can be initialized with variables as well as real numbers. A program that demonstrates this is given as follows.Example Live Demo#include using namespace std; int main() {    int a = 5;    int b = 3;    int arr[4];    arr[0] = a;    arr[1] = 8;    arr[2] = b;    arr[3] = 2;    cout

Advertisements