Skip to content

Implementation of a generic Deque in C++ without using any STL.

Notifications You must be signed in to change notification settings

somyalalwani/Deque-Implementation

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 

Repository files navigation

Data Structures & Algorithms for Problem

Languages Used : C++

C++ STL not used.

Problem:

Statement : Implementation of deque.

What is deque?

 Deque is the same as dynamic arrays with the ability to resize itself automatically when an element is inserted or deleted, with their storage being handled
automatically by the container.
 They support insertion and Deletion from both ends in amortized constant time.
 Inserting and erasing in the middle is linear in time.

What is expected as solution?

The C++ standard specifies that a legal (i.e., standard- conforming) implementation of deque must satisfy the following performance requirements:

 deque() - initialize a blank deque.
 deque(n,x) - initialize a deque of length n with all values as x.
 push_back(x) - append data x at the end.
 pop_back() - erase data at the end.
 push_front(x) - append data x at the beginning.
 pop_front() - erase data at the beginning.
 front() - returns the first element(value) in the deque.
 back() - returns the last element(value) in the deque.
 empty() - returns true if deque is empty else returns false.
 size() - returns the current size of deque.
 resize(x, d) - changes the size dynamically. If the new size is greater than the current size of the deque, then fill the empty space with the default value d.
 clear() - remove all elements of deque.
 D[n] - returns the nth element of the deque.

About

Implementation of a generic Deque in C++ without using any STL.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages