MCPcopy Create free account
hub / github.com/codemistic/Data-Structures-and-Algorithms / Array

Class Array

Arrays/18_Menu_Based_problem.cpp:5–51  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3#include <iostream>
4using namespace std;
5class Array
6{
7private:
8 int *A;
9 int size;
10 int length;
11 void swap(int *x,int *y);
12
13public:
14 Array()
15 {
16 size=10;
17 length=0;
18 A=new int[size];
19 }
20 Array(int sz)
21 {
22 size=sz;
23 length=0;
24 A=new int[size];
25 }
26 ~Array()
27 {
28 delete []A;
29 }
30 void Display();
31 void Append(int x);
32 void Insert(int index,int x);
33 int Delete(int index);
34 int LinearSearch(int key);
35 int BinarySearch(int key);
36 int Get(int index);
37 void Set(int index,int x);
38 int Max();
39 int Min();
40 int Sum();
41 float Avg();
42 void Reverse();
43 void Reverse2();
44 void InsertSort(int x);
45 int isSorted();
46 void Rearrange();
47 Array* Merge(Array arr2);
48 Array* Union(Array arr2);
49 Array* Diff(Array arr2);
50 Array* Inter(Array arr2);
51};
52void Array::Display()
53{
54 int i;

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected