Skip to content

Commit d2a6be8

Browse files
committed
Some Updates
1 parent d72e119 commit d2a6be8

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

Data Structure - Linear (Arrays).cpp

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ public :
1616
myArr = new int[arrSize];
1717
};
1818

19-
2019
//Operations on Arrays
2120
//1- Fill
2221
void Fill(){
@@ -49,6 +48,7 @@ public :
4948
return index;
5049
};
5150

51+
//3- Appending
5252
void append(int newItem){
5353
if (length < size){
5454
myArr[length] = newItem;
@@ -59,7 +59,7 @@ public :
5959
}
6060
}
6161

62-
//3- Insertion
62+
//4- Insertion
6363
void insert(int index, int newItem){
6464
if (index >= 0 && index < size){
6565
for (int i = length; i > index; i--){
@@ -73,8 +73,7 @@ public :
7373
}
7474
};
7575

76-
77-
//4- Deletion
76+
//5- Deletion
7877
void remove(int index){
7978
if (index >= 0 && index < size){
8079
for (int i = index; i < length - 1; i++){
@@ -87,7 +86,7 @@ public :
8786
}
8887
}
8988

90-
//5- Increase Array Size
89+
//6- Increase Array Size
9190
void enLarge(int newIndex){
9291
if (newIndex <= size){
9392
cout << "the new size must be larger than current size\n" ;
@@ -104,7 +103,7 @@ public :
104103
};
105104
};
106105

107-
//6- Merge two Arrays
106+
//7- Merge two Arrays
108107
void merge(Array other){
109108
int newSize = size + other.getSize();
110109
size = newSize;
@@ -122,7 +121,7 @@ public :
122121
};
123122
};
124123

125-
//7- Display Array Items
124+
//8- Display Array Items
126125
void Diplay(){
127126
cout << "Display Array Items\n";
128127
for (int i = 0; i < length; i++){
@@ -131,12 +130,12 @@ public :
131130
cout << endl;
132131
};
133132

134-
//8- Get Array Size
133+
//9- Get Array Size
135134
int getSize(){
136135
return size;
137136
};
138137

139-
//9- Get Array Length
138+
//10- Get Array Length
140139
int getLength(){
141140
return length;
142141
};

0 commit comments

Comments
 (0)