SlideShare a Scribd company logo
1 of 6
Part 1: Your tasks for this assignment are the following:
1. Discuss the use of a binary tree when searching for keys in an
array.
If the array is ordered, binary search can be performed on it.
The key value is used to search for the item or perform other
operations on it.
Binary tree can be created from an array to perform faster
searches. Every node in a binary tree can have at most two
children.
The two children of each node are called the left child and right
child corresponding to their positions.
A node can have only a left child or only a right child, or it can
have no children at all.
Left child is always less that its parent, while right child is
greater than its parent.
To find a node given its key value, start from the root.
If the key value is same as the node, then node is found.
If key is greater than node, search the right sub tree, else search
the left sub tree.
Continue till the node is found or the entire tree is traversed.
Time required to find a node depends on how many levels down
it is situated, i.e. O(log N).
· Assume number of nodes N and number of levels L.
· N = 2L -1
· N+1 = 2L
· L = log(N+1)
· The time needed to carry out the common tree operations is
proportional to the base 2 log of N
O(log N) time is required for these operations
Discuss the use of a binary tree when searching for keys in a
linked list.
Binary Tree can be implemented using linked list. Binary trees
are one of the most efficient data structures for sorting data. If
the data is sorted (Binary Search Tree), searching will be faster.
Binary tree has node. Each one is linked to two different nodes,
a left node and a right node. Every node have a comparable key
and follows the restriction that the key belonging to any node is
larger than nodes is higher than the keys on all the client nodes.
In a linked list, the items are associated together through a
single next pointer. In a binary tree, each node can have 0, 1 or
2 sub nodes, where (in case of a binary search tree) the key of
the left node is lesser than the key of the node and the key of
the right node is more than the node. As long as the tree is
balanced, the search path to each item is a lot shorter than that
in a linked list.
Part 2: Complete the following program:
1. Describe a linked list structure to support binary searching.
With a plain linked list, you cannot do binary search directly,
since random access on linked lists is O(n). The main issue,
besides that you have no constant-time access to the linked list
elements, is that you have no information about the length of
the list. In this case, you simply have no way to "cut" the list in
2 halves.
If a linked list is sorted, we can create a method which can
return middle node.
A linked list structure to support binary searching is assumed to
be like this:
A linked list has a Head pointer, that indicates to the first node
of the tilt.
Each node in turn stores some data (represented by 20 , 5 , 32 &
14 in the above image) and a pointer to the following node in
the tilt.
Likewise, as seen in a higher place, the last node of the Linked
list has its 'next' pointer, pointing to NULL.
This is a linked list structure type:
struct node
{
int data; // Integer data
node * next; // Pointer to next node in Linked List
};
node * head; // Head of linked list
2. Create pseudo code to describe a binary search with this
linked list variation.
We get out the middle node between any two nodes of a linked
list.
node * middleNode( node * startNode , node * endNode)
if( startNode == NULL )
// Linked list is empty
return NULL
END
node * slowPtr = startNode
node * fastPtr = startNode -> next
while ( fastPtr != endNode )
fastPtr = fastPtr -> next
if( fastPtr != endNode )
slowPtr = slowPtr -> next // Notice that for
each loop iteration :
fastPtr = fastPtr -> next // slowPtr moves
just one location
// while fastPtr moves two
nodes at a time.
END
END
return slowPtr // At the end , the slowPtr will be
pointing to the middle node
END
node * binarySearch( int valueToSearch )
node * startNode = head
node * endNode = NULL
do
node * middle = middleNode( startNode , endNode )
if( middle == NULL )
// element not present
return NULL
END
if( middle->data == valueToSearch )
return middle
END
else if ( middle->data < valueToSearch )
// need to search in upper half
startNode = middle->next
END
else
// need to search in lower half
endNode = middle
END
ENDwhile( endNode == NULL || endNode->next !=
startNode )
// data not present
return NULL
END
Think of a strategy pursued by the company your work for,
another company, or even a sports team. How can game theory
help improve the outcomes for the decision makers? Explain
whether simultaneous-move, repeated-move, or sequential-move
games are most applicable. Are there incentives for collusion?
Should a random strategy be used? What differences in
outcomes might you expect if the decision maker uses game
theory when developing strategies?
Make sure to give specific real-world examples.
1 page (cover and reference page not counted).
This is for an economic course.
Part 1 Your tasks for this assignment are the following1. Disc.docx

More Related Content

Similar to Part 1 Your tasks for this assignment are the following1. Disc.docx

Binary Search Tree
Binary Search TreeBinary Search Tree
Binary Search TreeZafar Ayub
 
Binary Tree - Algorithms
Binary Tree - Algorithms Binary Tree - Algorithms
Binary Tree - Algorithms CourseHunt
 
In this lab we will write code for working with a Linked List. Node .pdf
In this lab we will write code for working with a Linked List.  Node .pdfIn this lab we will write code for working with a Linked List.  Node .pdf
In this lab we will write code for working with a Linked List. Node .pdffms12345
 
Fundamentalsofdatastructures 110501104205-phpapp02
Fundamentalsofdatastructures 110501104205-phpapp02Fundamentalsofdatastructures 110501104205-phpapp02
Fundamentalsofdatastructures 110501104205-phpapp02Getachew Ganfur
 
Fundamentals of data structures
Fundamentals of data structuresFundamentals of data structures
Fundamentals of data structuresNiraj Agarwal
 
Different types of Linked list.
Different types of Linked list.Different types of Linked list.
Different types of Linked list.JAYANTAOJHA
 
Linked List Presentation in data structurepptx
Linked List Presentation in data structurepptxLinked List Presentation in data structurepptx
Linked List Presentation in data structurepptxnikhilcse1
 
Operations on linked list
Operations on linked listOperations on linked list
Operations on linked listSumathi Kv
 
Binary trees
Binary treesBinary trees
Binary treesAmit Vats
 
linked list using c
linked list using clinked list using c
linked list using cVenkat Reddy
 
computer notes - Linked list
computer notes - Linked listcomputer notes - Linked list
computer notes - Linked listecomputernotes
 

Similar to Part 1 Your tasks for this assignment are the following1. Disc.docx (20)

Binary Search Tree
Binary Search TreeBinary Search Tree
Binary Search Tree
 
Binary search tree(bst)
Binary search tree(bst)Binary search tree(bst)
Binary search tree(bst)
 
Binary Tree - Algorithms
Binary Tree - Algorithms Binary Tree - Algorithms
Binary Tree - Algorithms
 
In this lab we will write code for working with a Linked List. Node .pdf
In this lab we will write code for working with a Linked List.  Node .pdfIn this lab we will write code for working with a Linked List.  Node .pdf
In this lab we will write code for working with a Linked List. Node .pdf
 
Link list
Link listLink list
Link list
 
Fundamentalsofdatastructures 110501104205-phpapp02
Fundamentalsofdatastructures 110501104205-phpapp02Fundamentalsofdatastructures 110501104205-phpapp02
Fundamentalsofdatastructures 110501104205-phpapp02
 
Tree data structure
Tree data structureTree data structure
Tree data structure
 
Fundamentals of data structures
Fundamentals of data structuresFundamentals of data structures
Fundamentals of data structures
 
Different types of Linked list.
Different types of Linked list.Different types of Linked list.
Different types of Linked list.
 
Linked List Presentation in data structurepptx
Linked List Presentation in data structurepptxLinked List Presentation in data structurepptx
Linked List Presentation in data structurepptx
 
Operations on linked list
Operations on linked listOperations on linked list
Operations on linked list
 
linked list.pptx
linked list.pptxlinked list.pptx
linked list.pptx
 
Binary trees
Binary treesBinary trees
Binary trees
 
Data Structure
Data StructureData Structure
Data Structure
 
Binary search tree
Binary search treeBinary search tree
Binary search tree
 
Linkedlist
LinkedlistLinkedlist
Linkedlist
 
linked list using c
linked list using clinked list using c
linked list using c
 
Bao cao
Bao caoBao cao
Bao cao
 
computer notes - Linked list
computer notes - Linked listcomputer notes - Linked list
computer notes - Linked list
 
UNIT-4 TREES.ppt
UNIT-4 TREES.pptUNIT-4 TREES.ppt
UNIT-4 TREES.ppt
 

More from herbertwilson5999

Write a 5-7 page paper describing the historical development of info.docx
Write a 5-7 page paper describing the historical development of info.docxWrite a 5-7 page paper describing the historical development of info.docx
Write a 5-7 page paper describing the historical development of info.docxherbertwilson5999
 
Write a  5 paragraph essay related to the healthcare fieldthree.docx
Write a  5 paragraph essay related to the healthcare fieldthree.docxWrite a  5 paragraph essay related to the healthcare fieldthree.docx
Write a  5 paragraph essay related to the healthcare fieldthree.docxherbertwilson5999
 
Write at least a six-page paper, in which youIdentify the.docx
Write at least a six-page paper, in which youIdentify the.docxWrite at least a six-page paper, in which youIdentify the.docx
Write at least a six-page paper, in which youIdentify the.docxherbertwilson5999
 
Write a 2 page paper analyzing the fact pattern scenario below. Plea.docx
Write a 2 page paper analyzing the fact pattern scenario below. Plea.docxWrite a 2 page paper analyzing the fact pattern scenario below. Plea.docx
Write a 2 page paper analyzing the fact pattern scenario below. Plea.docxherbertwilson5999
 
Write a 2 page paper analyzing the fact pattern scenario below. .docx
Write a 2 page paper analyzing the fact pattern scenario below. .docxWrite a 2 page paper analyzing the fact pattern scenario below. .docx
Write a 2 page paper analyzing the fact pattern scenario below. .docxherbertwilson5999
 
Write a 100-word response in Spanish that addresses both of .docx
Write a 100-word response in Spanish that addresses both of .docxWrite a 100-word response in Spanish that addresses both of .docx
Write a 100-word response in Spanish that addresses both of .docxherbertwilson5999
 
Write a  Request for Proposal (approx. 3 - 4 pages in a word doc.docx
Write a  Request for Proposal (approx. 3 - 4 pages in a word doc.docxWrite a  Request for Proposal (approx. 3 - 4 pages in a word doc.docx
Write a  Request for Proposal (approx. 3 - 4 pages in a word doc.docxherbertwilson5999
 
Write a  5 paragraph essay related to Physical Therapy Assistant th.docx
Write a  5 paragraph essay related to Physical Therapy Assistant th.docxWrite a  5 paragraph essay related to Physical Therapy Assistant th.docx
Write a  5 paragraph essay related to Physical Therapy Assistant th.docxherbertwilson5999
 
Write a  5 page paper with  at-least three images that represent.docx
Write a  5 page paper with  at-least three images that represent.docxWrite a  5 page paper with  at-least three images that represent.docx
Write a  5 page paper with  at-least three images that represent.docxherbertwilson5999
 
Write a  5 paragraph essay related to the healthcare fieldthree maj.docx
Write a  5 paragraph essay related to the healthcare fieldthree maj.docxWrite a  5 paragraph essay related to the healthcare fieldthree maj.docx
Write a  5 paragraph essay related to the healthcare fieldthree maj.docxherbertwilson5999
 
Write at least Ten sentences on your discussion. Compare and con.docx
Write at least Ten sentences on your discussion. Compare and con.docxWrite at least Ten sentences on your discussion. Compare and con.docx
Write at least Ten sentences on your discussion. Compare and con.docxherbertwilson5999
 
Write at least a three-page analysis using the case study on pages.docx
Write at least a three-page analysis using the case study on pages.docxWrite at least a three-page analysis using the case study on pages.docx
Write at least a three-page analysis using the case study on pages.docxherbertwilson5999
 
Write at least a six-page paper, in which you Identify th.docx
Write at least a six-page paper, in which you Identify th.docxWrite at least a six-page paper, in which you Identify th.docx
Write at least a six-page paper, in which you Identify th.docxherbertwilson5999
 
Write at least a paragraph for each.1) What is your understand.docx
Write at least a paragraph for each.1) What is your understand.docxWrite at least a paragraph for each.1) What is your understand.docx
Write at least a paragraph for each.1) What is your understand.docxherbertwilson5999
 
Write at least 500 words analyzing a subject you find in this .docx
Write at least 500 words analyzing a subject you find in this .docxWrite at least 500 words analyzing a subject you find in this .docx
Write at least 500 words analyzing a subject you find in this .docxherbertwilson5999
 
Write at least 750 words paper on Why is vulnerability assessme.docx
Write at least 750 words paper on Why is vulnerability assessme.docxWrite at least 750 words paper on Why is vulnerability assessme.docx
Write at least 750 words paper on Why is vulnerability assessme.docxherbertwilson5999
 
Write As if You Are Writing in Your Journal (1st Person)Your T.docx
Write As if You Are Writing in Your Journal (1st Person)Your T.docxWrite As if You Are Writing in Your Journal (1st Person)Your T.docx
Write As if You Are Writing in Your Journal (1st Person)Your T.docxherbertwilson5999
 
Write an original, Scholarly Paper, addressing a topic relevant to t.docx
Write an original, Scholarly Paper, addressing a topic relevant to t.docxWrite an original, Scholarly Paper, addressing a topic relevant to t.docx
Write an original, Scholarly Paper, addressing a topic relevant to t.docxherbertwilson5999
 
Write an observation essay that explains the unique significance.docx
Write an observation essay that explains the unique significance.docxWrite an observation essay that explains the unique significance.docx
Write an observation essay that explains the unique significance.docxherbertwilson5999
 
Write an introduction in APA format in about 2 pages to describe.docx
Write an introduction in APA format in about 2 pages to describe.docxWrite an introduction in APA format in about 2 pages to describe.docx
Write an introduction in APA format in about 2 pages to describe.docxherbertwilson5999
 

More from herbertwilson5999 (20)

Write a 5-7 page paper describing the historical development of info.docx
Write a 5-7 page paper describing the historical development of info.docxWrite a 5-7 page paper describing the historical development of info.docx
Write a 5-7 page paper describing the historical development of info.docx
 
Write a  5 paragraph essay related to the healthcare fieldthree.docx
Write a  5 paragraph essay related to the healthcare fieldthree.docxWrite a  5 paragraph essay related to the healthcare fieldthree.docx
Write a  5 paragraph essay related to the healthcare fieldthree.docx
 
Write at least a six-page paper, in which youIdentify the.docx
Write at least a six-page paper, in which youIdentify the.docxWrite at least a six-page paper, in which youIdentify the.docx
Write at least a six-page paper, in which youIdentify the.docx
 
Write a 2 page paper analyzing the fact pattern scenario below. Plea.docx
Write a 2 page paper analyzing the fact pattern scenario below. Plea.docxWrite a 2 page paper analyzing the fact pattern scenario below. Plea.docx
Write a 2 page paper analyzing the fact pattern scenario below. Plea.docx
 
Write a 2 page paper analyzing the fact pattern scenario below. .docx
Write a 2 page paper analyzing the fact pattern scenario below. .docxWrite a 2 page paper analyzing the fact pattern scenario below. .docx
Write a 2 page paper analyzing the fact pattern scenario below. .docx
 
Write a 100-word response in Spanish that addresses both of .docx
Write a 100-word response in Spanish that addresses both of .docxWrite a 100-word response in Spanish that addresses both of .docx
Write a 100-word response in Spanish that addresses both of .docx
 
Write a  Request for Proposal (approx. 3 - 4 pages in a word doc.docx
Write a  Request for Proposal (approx. 3 - 4 pages in a word doc.docxWrite a  Request for Proposal (approx. 3 - 4 pages in a word doc.docx
Write a  Request for Proposal (approx. 3 - 4 pages in a word doc.docx
 
Write a  5 paragraph essay related to Physical Therapy Assistant th.docx
Write a  5 paragraph essay related to Physical Therapy Assistant th.docxWrite a  5 paragraph essay related to Physical Therapy Assistant th.docx
Write a  5 paragraph essay related to Physical Therapy Assistant th.docx
 
Write a  5 page paper with  at-least three images that represent.docx
Write a  5 page paper with  at-least three images that represent.docxWrite a  5 page paper with  at-least three images that represent.docx
Write a  5 page paper with  at-least three images that represent.docx
 
Write a  5 paragraph essay related to the healthcare fieldthree maj.docx
Write a  5 paragraph essay related to the healthcare fieldthree maj.docxWrite a  5 paragraph essay related to the healthcare fieldthree maj.docx
Write a  5 paragraph essay related to the healthcare fieldthree maj.docx
 
Write at least Ten sentences on your discussion. Compare and con.docx
Write at least Ten sentences on your discussion. Compare and con.docxWrite at least Ten sentences on your discussion. Compare and con.docx
Write at least Ten sentences on your discussion. Compare and con.docx
 
Write at least a three-page analysis using the case study on pages.docx
Write at least a three-page analysis using the case study on pages.docxWrite at least a three-page analysis using the case study on pages.docx
Write at least a three-page analysis using the case study on pages.docx
 
Write at least a six-page paper, in which you Identify th.docx
Write at least a six-page paper, in which you Identify th.docxWrite at least a six-page paper, in which you Identify th.docx
Write at least a six-page paper, in which you Identify th.docx
 
Write at least a paragraph for each.1) What is your understand.docx
Write at least a paragraph for each.1) What is your understand.docxWrite at least a paragraph for each.1) What is your understand.docx
Write at least a paragraph for each.1) What is your understand.docx
 
Write at least 500 words analyzing a subject you find in this .docx
Write at least 500 words analyzing a subject you find in this .docxWrite at least 500 words analyzing a subject you find in this .docx
Write at least 500 words analyzing a subject you find in this .docx
 
Write at least 750 words paper on Why is vulnerability assessme.docx
Write at least 750 words paper on Why is vulnerability assessme.docxWrite at least 750 words paper on Why is vulnerability assessme.docx
Write at least 750 words paper on Why is vulnerability assessme.docx
 
Write As if You Are Writing in Your Journal (1st Person)Your T.docx
Write As if You Are Writing in Your Journal (1st Person)Your T.docxWrite As if You Are Writing in Your Journal (1st Person)Your T.docx
Write As if You Are Writing in Your Journal (1st Person)Your T.docx
 
Write an original, Scholarly Paper, addressing a topic relevant to t.docx
Write an original, Scholarly Paper, addressing a topic relevant to t.docxWrite an original, Scholarly Paper, addressing a topic relevant to t.docx
Write an original, Scholarly Paper, addressing a topic relevant to t.docx
 
Write an observation essay that explains the unique significance.docx
Write an observation essay that explains the unique significance.docxWrite an observation essay that explains the unique significance.docx
Write an observation essay that explains the unique significance.docx
 
Write an introduction in APA format in about 2 pages to describe.docx
Write an introduction in APA format in about 2 pages to describe.docxWrite an introduction in APA format in about 2 pages to describe.docx
Write an introduction in APA format in about 2 pages to describe.docx
 

Recently uploaded

1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdfQucHHunhnh
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformChameera Dedduwage
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxGaneshChakor2
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...Marc Dusseiller Dusjagr
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationnomboosow
 
Separation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesSeparation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesFatimaKhan178732
 
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991RKavithamani
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingTechSoup
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdfQucHHunhnh
 
Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...
Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...
Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...RKavithamani
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13Steve Thomason
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxpboyjonauth
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfsanyamsingh5019
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Celine George
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)eniolaolutunde
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactdawncurless
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxSayali Powar
 

Recently uploaded (20)

1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy Reform
 
Staff of Color (SOC) Retention Efforts DDSD
Staff of Color (SOC) Retention Efforts DDSDStaff of Color (SOC) Retention Efforts DDSD
Staff of Color (SOC) Retention Efforts DDSD
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptx
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communication
 
Separation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesSeparation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and Actinides
 
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
 
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptxINDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
 
Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...
Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...
Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptx
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdf
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impact
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
 

Part 1 Your tasks for this assignment are the following1. Disc.docx

  • 1. Part 1: Your tasks for this assignment are the following: 1. Discuss the use of a binary tree when searching for keys in an array. If the array is ordered, binary search can be performed on it. The key value is used to search for the item or perform other operations on it. Binary tree can be created from an array to perform faster searches. Every node in a binary tree can have at most two children. The two children of each node are called the left child and right child corresponding to their positions. A node can have only a left child or only a right child, or it can have no children at all. Left child is always less that its parent, while right child is greater than its parent. To find a node given its key value, start from the root. If the key value is same as the node, then node is found. If key is greater than node, search the right sub tree, else search the left sub tree. Continue till the node is found or the entire tree is traversed. Time required to find a node depends on how many levels down it is situated, i.e. O(log N). · Assume number of nodes N and number of levels L. · N = 2L -1 · N+1 = 2L · L = log(N+1) · The time needed to carry out the common tree operations is proportional to the base 2 log of N O(log N) time is required for these operations Discuss the use of a binary tree when searching for keys in a linked list. Binary Tree can be implemented using linked list. Binary trees are one of the most efficient data structures for sorting data. If the data is sorted (Binary Search Tree), searching will be faster.
  • 2. Binary tree has node. Each one is linked to two different nodes, a left node and a right node. Every node have a comparable key and follows the restriction that the key belonging to any node is larger than nodes is higher than the keys on all the client nodes. In a linked list, the items are associated together through a single next pointer. In a binary tree, each node can have 0, 1 or 2 sub nodes, where (in case of a binary search tree) the key of the left node is lesser than the key of the node and the key of the right node is more than the node. As long as the tree is balanced, the search path to each item is a lot shorter than that in a linked list. Part 2: Complete the following program: 1. Describe a linked list structure to support binary searching. With a plain linked list, you cannot do binary search directly, since random access on linked lists is O(n). The main issue, besides that you have no constant-time access to the linked list elements, is that you have no information about the length of the list. In this case, you simply have no way to "cut" the list in 2 halves. If a linked list is sorted, we can create a method which can return middle node. A linked list structure to support binary searching is assumed to be like this: A linked list has a Head pointer, that indicates to the first node of the tilt. Each node in turn stores some data (represented by 20 , 5 , 32 & 14 in the above image) and a pointer to the following node in the tilt. Likewise, as seen in a higher place, the last node of the Linked list has its 'next' pointer, pointing to NULL.
  • 3. This is a linked list structure type: struct node { int data; // Integer data node * next; // Pointer to next node in Linked List }; node * head; // Head of linked list 2. Create pseudo code to describe a binary search with this linked list variation. We get out the middle node between any two nodes of a linked list. node * middleNode( node * startNode , node * endNode) if( startNode == NULL ) // Linked list is empty return NULL END node * slowPtr = startNode node * fastPtr = startNode -> next while ( fastPtr != endNode ) fastPtr = fastPtr -> next if( fastPtr != endNode )
  • 4. slowPtr = slowPtr -> next // Notice that for each loop iteration : fastPtr = fastPtr -> next // slowPtr moves just one location // while fastPtr moves two nodes at a time. END END return slowPtr // At the end , the slowPtr will be pointing to the middle node END node * binarySearch( int valueToSearch ) node * startNode = head node * endNode = NULL do node * middle = middleNode( startNode , endNode ) if( middle == NULL ) // element not present return NULL END if( middle->data == valueToSearch ) return middle END else if ( middle->data < valueToSearch ) // need to search in upper half
  • 5. startNode = middle->next END else // need to search in lower half endNode = middle END ENDwhile( endNode == NULL || endNode->next != startNode ) // data not present return NULL END Think of a strategy pursued by the company your work for, another company, or even a sports team. How can game theory help improve the outcomes for the decision makers? Explain whether simultaneous-move, repeated-move, or sequential-move games are most applicable. Are there incentives for collusion? Should a random strategy be used? What differences in outcomes might you expect if the decision maker uses game theory when developing strategies? Make sure to give specific real-world examples. 1 page (cover and reference page not counted). This is for an economic course.