Posts

Showing posts with the label python data structure

Introduction to Linked List| Data Structure with Python

Image
   Linked List is a linear data structure. Unlike arrays, linked list elements are not stored at a contiguous location. The element are linked using pointers. Why Linked list is used:- Arrays can be used to store linear data of similar types, but arrays have the following limitations. Array's size is fixed. So we must know the highest limit of the array in advance. So we must declare the size of the array first and elements there after.  Inserting a new element is very expensive because the room has to be be created for the new elements and shift the existing elements. Ex :- Suppose we have arrays in sorted order   i.e. [1,2,3,4,6,7]  and we have to insert new element   i.e. [5]   in the array. So in order to maintain elements in sorted order, we have to place that element after suitable element. In this situation we have to shift the element   i.e. [6,7] by position 1. Now  we saw the arrays limitations. Let's understand the advantages of the Linked List over array.  Advantage

Data Structure using Python| codin india

Image
  Data Structure   is a particular way of organizing data in a Computer, so that it can be used effectively. For Example:-   We can store a list of items having the same data-type using arrays. Data structures are fundamental concepts of computer science which helps is writing efficient programs in any language. Python is a high-level, interpreted, interactive and object-oriented scripting language using which we can study the fundamentals of data structure in a simpler way as compared to other programming languages. Types of Data Structure Data structures in computer science are divided into two categories. We will discuss about each of the below data structures in detail one by one. In today's post we will only discuss about data structure definition and its types. We will learn and implement its various types one by one with example. Data Structure Linear Data Structure Non-Linear Data Structure Linear Data Structure A Linear data structure have data elements arranged in sequent

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