Posts

Showing posts with the label user defined data structures

Data Structures and Algorithms - Arrays (2)

Image
Array is a container which can hold a fix number of items and these items should be of the same type. Most of the data structures make use of arrays to implement their algorithms. Following are the important terms to understand the concept of Array. Element  − Each item stored in an array is called an element. Index  − Each location of an element in an array has a numerical index, which is used to identify the element. Array Representation Arrays can be declared in various ways in different languages. For illustration, let's take C array declaration. Arrays can be declared in various ways in different languages. For illustration, let's take C array declaration. As per the above illustration, following are the important points to be considered. Index starts with 0. Array length is 10 which means it can store 10 elements. Each element can be accessed via its index. For example, we can fetch an element at index 6 as 9. Basic Operations Following are the basic operations supported

Data Structures & Algorithms - Quick Guide (Step By Step) (1)

Image
  Overview Data Structure is a systematic way to organize data in order to use it efficiently. Following terms are the foundation terms of a data structure. Interface  − Each data structure has an interface. Interface represents the set of operations that a data structure supports. An interface only provides the list of supported operations, type of parameters they can accept and return type of these operations. Implementation  − Implementation provides the internal representation of a data structure. Implementation also provides the definition of the algorithms used in the operations of the data structure. Characteristics of a Data Structure Correctness  − Data structure implementation should implement its interface correctly. Time Complexity  − Running time or the execution time of operations of data structure must be as small as possible. Space Complexity  − Memory usage of a data structure operation should be as little as possible. Need for Data Structure As applications are gettin

User Defined data structure - Python | codin india

Image
  In computer science, a data structure is a logical way of organizing data in computer memory so that it can be used effectively. A data structure allows data to be added, removed, stored and maintained in a structured manner. Python supports two types of data structures: 1. Non-primitive data types:- Python has list, set, tuples and dictionary as its non-primitive data types which can also be considered its in-built data structures. List Arrays Tuples Dictionaries 2. User-defined data structures:- Data Structures that aren't supported by python but can be programmed to reflect the same functionality using concepts supported by python are user-defined data structures. There are many data structures that can be implemented this way:- Linked List Stack Queue Tree  Graphs Hash map Linked List Data Structure:- A  Linked List  is a linear data structure, in which the elements are not stored at contiguous memory location. The elements in a linked list are linked using pointers. Python c