Data Structure and Algorithms Using C++
eBook - ePub

Data Structure and Algorithms Using C++

A Practical Implementation

Sachi Nandan Mohanty, Pabitra Kumar Tripathy

Share book
  1. English
  2. ePUB (mobile friendly)
  3. Available on iOS & Android
eBook - ePub

Data Structure and Algorithms Using C++

A Practical Implementation

Sachi Nandan Mohanty, Pabitra Kumar Tripathy

Book details
Book preview
Table of contents
Citations

About This Book

Everyone knows that programming plays a vital role as a solution to automate and execute a task in a proper manner. Irrespective of mathematical problems, the skills of programming are necessary to solve any type of problems that may be correlated to solve real life problems efficiently and effectively. This book is intended to flow from the basic concepts of C++ to technicalities of the programming language, its approach and debugging. The chapters of the book flow with the formulation of the problem, it's designing, finding the step-by-step solution procedure along with its compilation, debugging and execution with the output. Keeping in mind the learner's sentiments and requirements, the exemplary programs are narrated with a simple approach so that it can lead to creation of good programs that not only executes properly to give the output, but also enables the learners to incorporate programming skills in them. The style of writing a program using a programming language is also emphasized by introducing the inclusion of comments wherever necessary to encourage writing more readable and well commented programs. As practice makes perfect, each chapter is also enriched with practice exercise questions so as to build the confidence of writing the programs for learners. The book is a complete and all-inclusive handbook of C++ that covers all that a learner as a beginner would expect, as well as complete enough to go ahead with advanced programming. This book will provide a fundamental idea about the concepts of data structures and associated algorithms. By going through the book, the reader will be able to understand about the different types of algorithms and at which situation and what type of algorithms will be applicable.

Frequently asked questions

How do I cancel my subscription?
Simply head over to the account section in settings and click on “Cancel Subscription” - it’s as simple as that. After you cancel, your membership will stay active for the remainder of the time you’ve paid for. Learn more here.
Can/how do I download books?
At the moment all of our mobile-responsive ePub books are available to download via the app. Most of our PDFs are also available to download and we're working on making the final remaining ones downloadable now. Learn more here.
What is the difference between the pricing plans?
Both plans give you full access to the library and all of Perlego’s features. The only differences are the price and subscription period: With the annual plan you’ll save around 30% compared to 12 months on the monthly plan.
What is Perlego?
We are an online textbook subscription service, where you can get access to an entire online library for less than the price of a single book per month. With over 1 million books across 1000+ topics, we’ve got you covered! Learn more here.
Do you support text-to-speech?
Look out for the read-aloud symbol on your next book to see if you can listen to it. The read-aloud tool reads text aloud for you, highlighting the text as it is being read. You can pause it, speed it up and slow it down. Learn more here.
Is Data Structure and Algorithms Using C++ an online PDF/ePUB?
Yes, you can access Data Structure and Algorithms Using C++ by Sachi Nandan Mohanty, Pabitra Kumar Tripathy in PDF and/or ePUB format, as well as other popular books in Computer Science & Programming in C. We have over one million books available in our catalogue for you to explore.

Information

Year
2021
ISBN
9781119752035
Edition
1

1
Introduction to Data Structure

1.1 Definition and Use of Data Structure

Data structure is the representation of the logical relationship existing between individual elements of data. In other words the data structure is a way of organizing all data items that considers not only the elements stored but also their relationship to each other.
Data structure specifies
  • Organization of data
  • Accessing methods
  • Degree of associativity
  • Processing alternatives for information
The data structures are the building blocks of a program and hence the selection of a particular data structure stresses on
  • The data structures must be rich enough in structure to reflect the relationship existing between the data, and
  • The structure should be simple so that we can process data effectively whenever required.
In mathematically Algorithm + Data Structure = Program
Finally we can also define the data structure as the “Logical and mathematical model of a particular organization of data”

1.2 Types of Data Structure

Data structure can be broadly classified into two categories as Linear and Non-Linear
Schematic illustration of a tree diagram depicting the classification of the data structure.
Linear Data Structures
In linear data structures, values are arranged in linear fashion. Arrays, linked lists, stacks, and queues are the examples of linear data structures in which values are stored in a sequence.
Non-Linear Data Structure
This type is opposite to linear. The data values in this structure are not arranged in order. Tree, graph, table, and sets are the examples of nonlinear data structure.
Operations Performed in Data Structure
In data structure we can perform the operations like
  • Traversing
  • Insertion
  • Deletion
  • Merging
  • Sorting
  • Searching

1.3 Algorithm

The step by step procedure to solve a problem is known as the ALGORITHM. An algorithm is a well-organized, pre-arranged, and defined computational module that receives some values or set of values as input and provides a single or set of values as out put. These well-defined computational steps are arranged in sequence, which processes the given input into output.
An algorithm is said to be accurate and truthful only when it provides the exact wanted output.
The efficiency of an algorithm depends on the time and space complexities. The complexity of an algorithm is the function which gives the running time and/or space in terms of the input size.
Steps Required to Develop an Algorithm
  • Finding a method for solving a problem. Every step of an algorithm should be defined in a precise and in a clear manner. Pseudo code is also used to describe an algorithm.
  • The next step is to validate the algorithm. This step includes all the steps in our algorithm and should be done manually by giving the required input, perform the required steps including in our algorithm and should get the required amount of output in a finite amount of time.
  • Finally implement the algorithm in terms of programming language.
Mathematical Notations and Functions
  • Floor and Ceiling Functions
  • Floor function returns the greatest integer that does not exceed the number.
  • Ceiling function returns the least integer that is not less than the number.
    images
  • Remainder Function
    To find the remainder “mod” function is being used as
    images
  • To find the Integer and Absolute value of a number
    INT(5.34) = 5 This statement returns the integer part of the number
    INT(- 6.45) = 6 This statement returns the absolute as well as the integer portion of the number
  • Summation Symbol
    To add a series of number as a1+ a2 + a3 +............+ an the symbol Σ is used
    images
  • Factorial of a Number
    The product of the positive integers from 1 to n is known as the factorial of n and it is denoted as n!.
    images
Algorithemic Notations
While writing the algorithm the comments are provided with in [ ].
The assignment should use the symbol “: =” instead of “=”
For Input use Read : variable name
For output use write : message/variable name
The control structures can also be allowed to use inside an algorithm but their way of approaching will be some what different as
Simple If
 If condition, then: Statements [end of if structure] 
If...else
 If condition, then: Statements Else : Statements [end of if structure] 
If...else ladder
 If condition1, then: Statements Else If condition2, then: Statements Else If condition3, then: Statements ………………………………………… ………………………………………… ………………………………………… Else If conditionN, then: Statements Else: Statements [end of if structure]
LOOPING CONSTRUCT
 Repeat for var = start_value to end_value by step_value ...

Table of contents