Skip to content

Commit 7ecc705

Browse files
authored
Requested Changes
1 parent 81dda4d commit 7ecc705

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

double_ended_queue/doubleEndedQueue.c

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ struct Deque *createDeque(struct Deque *root, int key) //Function to create dequ
1717
head = root;
1818
last = root;
1919
return head;
20-
}
20+
} //O(1) time complexity
2121

2222
struct Deque *push_front(struct Deque *root, int key) //Function to push element on the front of deque
2323
{
@@ -31,7 +31,7 @@ struct Deque *push_front(struct Deque *root, int key) //Function to push element
3131
temp->next = head;
3232
head = temp;
3333
return head;
34-
}
34+
} //O(1) time complexity
3535

3636
struct Deque *push_back(struct Deque *root, int key) //Function to push element to the back of deque
3737
{
@@ -46,7 +46,7 @@ struct Deque *push_back(struct Deque *root, int key) //Function to push element
4646
last->next = temp;
4747
last = temp;
4848
return last;
49-
}
49+
} //O(1) time complexity
5050

5151
struct Deque *pop_front() //Function to remove or pop the front element
5252
{
@@ -60,7 +60,7 @@ struct Deque *pop_front() //Function to remove or pop the front element
6060
head = head->next;
6161
free(temp); //free the unwanted space
6262
return head;
63-
}
63+
} //O(1) time complexity
6464

6565
struct Deque *pop_back() //Function to remove element from back of deque
6666
{
@@ -80,7 +80,7 @@ struct Deque *pop_back() //Function to remove element from back of deque
8080
last = temp;
8181
free(temp2);//free the unwanted space
8282
return head;
83-
}
83+
} //O(n) time complexity
8484

8585
void front() //Function to give the front element of deque
8686
{
@@ -89,7 +89,7 @@ void front() //Function to give the front element of deque
8989
printf("Deque is empty.\n\n");
9090
}
9191
printf("The element at the front of deque is %d.\n\n", head->data);
92-
}
92+
} //O(1) time complexity
9393

9494
void back() //Function to give the back of deque
9595
{
@@ -98,7 +98,7 @@ void back() //Function to give the back of deque
9898
printf("Deque is empty\n");
9999
}
100100
printf("The element at the last of deque is %d.\n\n", last->data);
101-
}
101+
} //O(1) time complexity
102102

103103
void isEmpty() //Function to know whether deque is empty or not
104104
{
@@ -110,7 +110,7 @@ void isEmpty() //Function to know whether deque is empty or not
110110
{
111111
printf("No, list is not empty.\n\n");
112112
}
113-
}
113+
} //O(1) time complexity
114114

115115
void displayTheDeque() //Function to print the whole deque
116116
{
@@ -130,7 +130,8 @@ void displayTheDeque() //Function to print the whole deque
130130
}
131131
printf(" <-----End\n\n");
132132
}
133-
}
133+
} //O(n) time complexity
134+
134135
int main()
135136
{
136137
struct Deque *root = NULL;

0 commit comments

Comments
 (0)