implementation of arraylist function

Solutions on MaxInterview for implementation of arraylist function by the best coders in the world

showing results for - "implementation of arraylist function"
Gareth
03 Oct 2020
1ArrayList()
2{
3int items = 0;
4int landex=0;
5int *List= new int [items];
6}
7
8//Add function
9add(int n){
10arrayList[landex]=n;
11items++;
12landex++;
13
14if(items==landex)
15{
16arrayList=doubleCapa(arrayList, items);
17}
18}
19//deleteLast()
20int deleteLast()
21{
22int num=0;
23if(arrayList!=0)
24{
25numD=arrayList[size];
26arrayList[size]=NULL;
27if(items<landex*2)
28{
29arrayList=halfSize(arrayList, landex);
30}
31
32
33}
34else
35{
36cout << "Array contain no element";
37}
38
39return num;
40}
41//Size() functions
42int size()
43{
44int num=0;
45for(int i=0;i<arr.length;i++)
46{
47if(arr[i]!=NULL)
48num++;
49}
50
51return num;
52
53
54}
55//