A reflection paper on a video in youtube under the channel mycodeschool with the topic binary search tree

© All Rights Reserved

48 vues

A reflection paper on a video in youtube under the channel mycodeschool with the topic binary search tree

© All Rights Reserved

- Data Structures and Other Objects Using C++, Third Edition, by Michael Main and Walter Savitch
- 00.Syllabus
- AVL Trees
- Design Analysis of Algorithms
- 2003 Spring Exam1Key
- ram vray
- vfe18
- Binary Search Tree With All the Recursive and Non Recursive Traversals
- Example of Teaching Plan
- E2E Bridge Education Lesson 3
- Unit Test Question Paper Format1
- Camera Ready-Data Mining
- Model Question Paper BC0038 New
- Data Structures and Algorithms MCQ -1
- Job Scheduling1
- Information Strucutres
- Interview Experiences and Tips
- SMS-Based Urban Public Traffic Query Service
- Final Itimp03
- SAP Overview Manual

Vous êtes sur la page 1sur 4

Nikkie Evalla

BSIT2-6

Data Structure

In the following paper I will discuss what I have learned from watching an informative video by

mycodeschool entitled Data structures: Binary Search Tree. The purpose of this reflection paper and of the source

video as to how I sees it is to explain the Binary Search Tree. I decided to include a comparison of an array, linked list

and binary search tree running time for certain operations which is of course I also learnt from the said video to

further explain the topic.

As stated from our source, Binary search tree is a special kind of binary tree that organizes data for quick

search and update. This is just an introduction much like giving meaning to our main topic. This is followed by the

overview of two well-known data structure used for storing modifiable collection namely; an array and linked list. Use

an array or linked list as a modifiable collection to be able to search, insert and remove an element

Before anything else the source had a comparison amongst the two well-known data structure together with

the binary search tree. We will compute the running time for these operations; searching, inserting, and removal of

records of the two.

Starting off with the array, how integers will be stored in it is shown. This is done by creating a large enough

array to store the records marking the end of the list to determine if an index still contains a record and so as to say

that those after the mark are available space or empty indexes. For example, if we have index 18 marked as the end

then that means we have 19 records (of course 0 is included). To search let say variable x in the records we have to

scan the array from index 0 up to the marked end, if what we are searching for unfortunately is in the end as to what I

understood from the video is that we need to look through all the elements in the array. So let n be the number of

elements we have in our array therefore the running time of an array for the operation of searching will be

proportional to the number of elements n in it. The larger the array the higher the time it will consume to search for a

given x. The source denoted this as Search()= o()

Our previously done marker end will be very vital in the process of inserting a new record to the array; as

stated above those index that follows the maker end are all available space. This is where we will be adding the new

record, this is done by incrementing the marker end. After incrementing we can now add the new record which is an

integer in the case shown in the source video. For this operation (which is inserting) time taken will not depend on the

number of elements instead it is constant. It can be denoted as Insert()= o(1)

The next operation deleting is quite a crucial one. Say for example we want to remove the record in index 4,

in order to do that well have to shift all records to the right of index 4 one index to the left. Lastly we will decrement

our marker end thus resulting to a running operation of Remove()= o().

Moving forward to linked list this data structure runs almost the same as an array therefore the running time

of the operation search is also Search()= o() but in this case we are pertaining to number of nodes in the linked

list. In order to search we will have to traverse all the records of the whole list same as to an array we may need to

look through all the nodes in the linked list. While the cost of insertion in a linked list has two process either

Insertion()= o(1) if its at the head or Insertion()= o() at the tail. It is advised to insert at the head to keep the

running cost low and constant. In the process of removal we may have to traverse the linked list and search the

record checking at all the nodes Remove()= o().

We may think of these two as a suitable data structure for searching, inserting and removing. Even me I

would think of using it but after watching the first 5 minutes of the source video I doubt if you still have your initial

opinion regarding this. It has been clearly stated that in reality any of the two is not a practical method to use

although insertion between them is fast. One point that we may not have noticed is that these may consume a

relatively large amount of time if we have large collection of records. How about a record for a barangay with 1000

families most of them consisting of 4 members gaining a total of 4000 individual records? If we will go for an

estimated 1 second per search then we will end up consuming 4000 seconds searching for that certain x.

Computer nowadays deal with a vast amount of data. I couldnt just imagine how awful it was for a computer

to use either of the two with that number of data. The source video presented binary search as a solution for this

problem yet there are things needed to be considered when using this. First is that what you will be using shall be an

array and that your array should be sorted resulting at BinarySearch()= o(log). I have mentioned that the source

uses a simple integer as its data type so sorting would be easy except when using string or any other data type we

should be able to binary search it based on some property or some key of the records. Although running cost of this

will be minimized especially when using a sorted array keeping it sorted is a hard task cause every time you will carry

out insertion or removal you have to make sure that it is sorted afterwards. Searching the position to where a certain

say x for example shall be put is very easy and fast, costing only o(log) but despite this insertion and removal

requires shifting of all the records from the index where well be inserting or removing a record. This shifting of

records will cost o() thus Insert()= o() and Remove()= o(). Using binary search for comparing and searching is

very practical yet the cost of insertion and removal is still unacceptable. The source video seeks for another practical

method to use with an acceptable running time for all the stated operations.

So summarizing everything we are looking for the most practical means of handling such

operations, this is exactly where the Binary Search Tree comes in. Binary search tree (BST) offers the cost of these

three operations in lowest value possible that is o(log) for average cases and will hit as low as o() for its worst

cases. Of course we can as much as possible avoid worst case scenarios by making sure that the tree is always

balanced.

Moving on lets tackle first how cost of binary search tree operations are minimized. By definition, binary

search tree is a binary tree in which for each node, value of all the nodes in left sub tree is lesser or equal (to handle

duplicates) and value of all the nodes in right sub tree is greater. In binary tree each node can have at most two

children. The source video illustrated binary search tree as a circle on top branching out to two more circles (one on

the left and one on the right) which in return also branches out into two more circles. The illustration has the data type

of integer with number 15 placed on the topmost circle. To check if the illustration is correct we divide the tree into

two; left and right after that we check if all the values of the circle on the left side is lower or equals the value on the

topmost of the tree (in our case its 15). The values on the right side is as follows; 10, 8 and 12 these are less than 15

so the left side of the tree is correct. Next is the same as the left side but this time we have to make sure that the

values in right side are always greater than 15. The illustration contains 20, 17 and 25 obviously these are greater

than 15 so the right side of the tree is also correct. By the way the source video states that the topmost value (15 in

our illustration) is called the root.

How is it really possible for binary search tree to have a cost of running as o(log) for searching, inserting

and deleting? First lets discuss search, this operates by comparing what you are searching for with the root. Lets

use the previous illustration for this. I would like for us to try and search for 12 so comparing 12 to 15 it is lesser in

this case we will continue searching for 12 on the left sub tree since weve known that left sub tree contain values

lesser than the root. The advantage of this is that we can reduce the elements we need to search through as we are

moving to the next steps making it a lot faster. The next root is 10 so do the same steps again, 12 is greater than 10

proceed the search to right sub tree we have root 12 in there and its equal to what we are searching for so the search

ends. We can experience the worst case if the tree is unbalanced hence reducing only one elements from the search

space. It only works as if it is somewhat a linked list so we experience much slower searching. The same goes for

inserting a new record to the binary tree, we start off comparing the root to the value we will add. If it is greater then

proceed to right else proceed to left sub tree. If there is still a child continue comparing until you reached where it

should be added place it as a child either to the left or to the right. Lastly for the deletion it is much like searching with

just a little bit of adjustment of nodes or links.

Clearing up the issues we have encountered there are 3 data structures that can be used for searching,

inserting and deleting records; an array, linked list and binary search tree. It is advisable to use binary search tree

among them because it has lower cost of running operations. Binary search tree encounters worst case wherein the

cost of running operations rose to a higher level and to avoid this we should make sure that the tree is always

balanced. Inserting and deleting records causes binary search tree to be unbalanced all we have to do is to restore

the balancing.

- Data Structures and Other Objects Using C++, Third Edition, by Michael Main and Walter SavitchTransféré parMd Rubaiyat Bhuiyan
- 00.SyllabusTransféré parelemaniaq
- AVL TreesTransféré parHanadi Dkheel
- Design Analysis of AlgorithmsTransféré parJanPatrik Guarin
- 2003 Spring Exam1KeyTransféré parPaVan Nelakuditi
- ram vrayTransféré parDavid Lopez Osa
- vfe18Transféré parNguyễn Văn Hiếu
- Binary Search Tree With All the Recursive and Non Recursive TraversalsTransféré parcompaq786
- Example of Teaching PlanTransféré parrockers91
- E2E Bridge Education Lesson 3Transféré parE2E Bridge Documentation
- Unit Test Question Paper Format1Transféré parRamesh Kumar
- Camera Ready-Data MiningTransféré parVijayalakshmi Ramar
- Model Question Paper BC0038 NewTransféré parari4uonly
- Data Structures and Algorithms MCQ -1Transféré parKuldeep Singh
- Job Scheduling1Transféré parRaghav Agrawal
- Information StrucutresTransféré parMandy Gill
- Interview Experiences and TipsTransféré parSumanth S Murthy
- SMS-Based Urban Public Traffic Query ServiceTransféré parkhoagle
- Final Itimp03Transféré parVigneshInfotech
- SAP Overview ManualTransféré parpganoel
- Ch15.3-Stu.pdfTransféré parRundong Huang
- introduction-to-data-structures (1).docTransféré parMohammed Jeelan
- Paper 3: CPs and TransformationsTransféré parRamzi H. Kawa
- Data Structures R10 Dec 2014Transféré parGopi Jampani
- 42demo-bsearchTransféré parpurplelydia
- avl intro.pdfTransféré parGeetRSB
- BstTransféré pardorababusujatha
- Coding Interview Cheat SheetTransféré parManish Bhatt
- 07+08slideTransféré parAbu Mohammad Mohammad
- Doublylist Dsa XamTransféré parPRE-GAMERS INC.

- cs164lec12Transféré parsinanPass3401
- Language GuideTransféré parEder Luis Pereira
- NetBackup Device Config GuideTransféré parHadi Ali
- Fiber Channel Arbitrated LoopTransféré paritzmitit
- TI3G 12 Tugas3 Galih Maulana Adji 1641720131Transféré parGalih
- 2A SAPTransféré parKaran Verma
- Vcs Db2 AgentTransféré parsubhasghosal27
- TCP vs UDP tunnel - TCP meltdownTransféré parabc
- Dmz - Best Practices - VsdTransféré parKashif Aziz Awan
- r05410410 Data Base Management SystemsTransféré parandhracolleges
- SDM_Express_v2_4Transféré pardabuferix
- Manual en Ingles PowerBuilderTransféré parnelson
- EM RepositoryTransféré parmuzairzahid
- DB2 commandsTransféré parjojireddyk
- AlgorithmTransféré parSasi TheLegend
- Installations OMSI 2Transféré parKapput
- rfc1889Transféré parchirrius
- Handout on SQL Server Analysis Services TutorialsTransféré parhnoor6
- Php File Navigator Inst and User GuideTransféré parrsevero
- OracleI_User_Guide.pdfTransféré paradailsonn
- Veeam Backup 9 0 PermissionsTransféré paranhtuan206
- MAA - FMW shared storage best practicesTransféré parMarcio Conceicao
- LDAP User GuideTransféré parLong Nguyen
- Configuring Wireless VLANTransféré parAziz London
- usb mikrotikTransféré parmarco antonio martinez andrade
- Requirements - CopyTransféré parachmads23
- Course SyllabusTransféré parSampuran_b
- (Kajal Maam)Four Ways to Build a Data WarehouseTransféré parrahul_mhatre_26
- BCP UtilityTransféré parPramod Chakravarthy
- Linux Instaaltion Guide5Transféré parkesavareddy

## Bien plus que des documents.

Découvrez tout ce que Scribd a à offrir, dont les livres et les livres audio des principaux éditeurs.

Annulez à tout moment.