SlideShare a Scribd company logo
1 of 1
Download to read offline
Q1. Write a python function that get's a list as an input and the median of its values. Median is the
middle number when you sort the list. If the list has even number of elements, median will be the
average of the two numbers in the middle Example: median of [5,4,8,2,9,1,3] is 4 and median of [4
,5,2,1,8,9] is (4+5)/2 or 4.5 . You can use python's own sorting algorithm. def find median (1st):
Q2. Write a python function that gets n and returns the nth value in the Pell sequence. Pell
sequence is defined by P(n)=2P(n1)+P(n2) while P(0)=0 and P(1)=1. Use your code to generate
and provide the first 10 values of Pell sequence. def pell (n): Section 2 - function Analysis ( 30
marks) Q3. Run an analysis of the function developed in Q2 and find its T(n) and big O
perforamance. Is finding the nth element of Pell sequence faster than bubble sort? Is it faster than
finding the nth element of the Fibonacci series?

More Related Content

Similar to Q1 Write a python function that gets a list as an input an.pdf

Similar to Q1 Write a python function that gets a list as an input an.pdf (20)

algorithm Unit 2
algorithm Unit 2 algorithm Unit 2
algorithm Unit 2
 
Unit 2 in daa
Unit 2 in daaUnit 2 in daa
Unit 2 in daa
 
Sorting
SortingSorting
Sorting
 
Chapter 4 ds
Chapter 4 dsChapter 4 ds
Chapter 4 ds
 
Data structure lecture 2
Data structure lecture 2Data structure lecture 2
Data structure lecture 2
 
L1803016468
L1803016468L1803016468
L1803016468
 
Design & Analysis Of Algorithm
Design & Analysis Of AlgorithmDesign & Analysis Of Algorithm
Design & Analysis Of Algorithm
 
Whiteboarding Coding Challenges in Python
Whiteboarding Coding Challenges in PythonWhiteboarding Coding Challenges in Python
Whiteboarding Coding Challenges in Python
 
NUMPY-2.pptx
NUMPY-2.pptxNUMPY-2.pptx
NUMPY-2.pptx
 
NUMPY [Autosaved] .pptx
NUMPY [Autosaved]                    .pptxNUMPY [Autosaved]                    .pptx
NUMPY [Autosaved] .pptx
 
Recurrence Relation
Recurrence RelationRecurrence Relation
Recurrence Relation
 
updated_tuple_in_python.pdf
updated_tuple_in_python.pdfupdated_tuple_in_python.pdf
updated_tuple_in_python.pdf
 
Ch 1 intriductions
Ch 1 intriductionsCh 1 intriductions
Ch 1 intriductions
 
lecture 10
lecture 10lecture 10
lecture 10
 
Top Most Python Interview Questions.pdf
Top Most Python Interview Questions.pdfTop Most Python Interview Questions.pdf
Top Most Python Interview Questions.pdf
 
CE344L-200365-Lab2.pdf
CE344L-200365-Lab2.pdfCE344L-200365-Lab2.pdf
CE344L-200365-Lab2.pdf
 
numpy.pdf
numpy.pdfnumpy.pdf
numpy.pdf
 
Q
QQ
Q
 
9781111530532 ppt ch14
9781111530532 ppt ch149781111530532 ppt ch14
9781111530532 ppt ch14
 
Profiling and optimization
Profiling and optimizationProfiling and optimization
Profiling and optimization
 

More from adyardrpradeep

Q1 Which of the following is NOT considered ossification co.pdf
Q1 Which of the following is NOT considered ossification co.pdfQ1 Which of the following is NOT considered ossification co.pdf
Q1 Which of the following is NOT considered ossification co.pdfadyardrpradeep
 
Q1 Your goal is to build a model to predict how people will.pdf
Q1 Your goal is to build a model to predict how people will.pdfQ1 Your goal is to build a model to predict how people will.pdf
Q1 Your goal is to build a model to predict how people will.pdfadyardrpradeep
 
Q24 Conduct a risk analysis and management process for the.pdf
Q24 Conduct a risk analysis and management process for the.pdfQ24 Conduct a risk analysis and management process for the.pdf
Q24 Conduct a risk analysis and management process for the.pdfadyardrpradeep
 
Q2 Design the pseudocode to print a binary tree At the vis.pdf
Q2 Design the pseudocode to print a binary tree At the vis.pdfQ2 Design the pseudocode to print a binary tree At the vis.pdf
Q2 Design the pseudocode to print a binary tree At the vis.pdfadyardrpradeep
 
Q2 Let X denote the amount of time for which a book onehou.pdf
Q2 Let X denote the amount of time for which a book onehou.pdfQ2 Let X denote the amount of time for which a book onehou.pdf
Q2 Let X denote the amount of time for which a book onehou.pdfadyardrpradeep
 
Q2 Given the total cost function Ca+bY with agt00ltb.pdf
Q2 Given the total cost function Ca+bY with agt00ltb.pdfQ2 Given the total cost function Ca+bY with agt00ltb.pdf
Q2 Given the total cost function Ca+bY with agt00ltb.pdfadyardrpradeep
 
Q2 A sample space S consists of five simple events with the.pdf
Q2 A sample space S consists of five simple events with the.pdfQ2 A sample space S consists of five simple events with the.pdf
Q2 A sample space S consists of five simple events with the.pdfadyardrpradeep
 
Q2 ClothsforYou plc is a medium sized UK listed interneton.pdf
Q2 ClothsforYou plc is a medium sized UK listed interneton.pdfQ2 ClothsforYou plc is a medium sized UK listed interneton.pdf
Q2 ClothsforYou plc is a medium sized UK listed interneton.pdfadyardrpradeep
 
Q1 Shale is a sedimentary rock a protolith of slate whic.pdf
Q1 Shale is a sedimentary rock a protolith of slate whic.pdfQ1 Shale is a sedimentary rock a protolith of slate whic.pdf
Q1 Shale is a sedimentary rock a protolith of slate whic.pdfadyardrpradeep
 
Q2 Mention whether the following instructions are right or.pdf
Q2  Mention whether the following instructions are right or.pdfQ2  Mention whether the following instructions are right or.pdf
Q2 Mention whether the following instructions are right or.pdfadyardrpradeep
 
Q2 5 marks An educational researcher believes that the me.pdf
Q2 5 marks An educational researcher believes that the me.pdfQ2 5 marks An educational researcher believes that the me.pdf
Q2 5 marks An educational researcher believes that the me.pdfadyardrpradeep
 
Q1 We read many accounts this week of what emerging indepen.pdf
Q1 We read many accounts this week of what emerging indepen.pdfQ1 We read many accounts this week of what emerging indepen.pdf
Q1 We read many accounts this week of what emerging indepen.pdfadyardrpradeep
 
Q1Unaudited information about significant events and uncer.pdf
Q1Unaudited information about significant events and uncer.pdfQ1Unaudited information about significant events and uncer.pdf
Q1Unaudited information about significant events and uncer.pdfadyardrpradeep
 
Q1413 What is the structure in coordinates J25 and J10 .pdf
Q1413 What is the structure in coordinates J25 and J10 .pdfQ1413 What is the structure in coordinates J25 and J10 .pdf
Q1413 What is the structure in coordinates J25 and J10 .pdfadyardrpradeep
 
q10 Euromarket investment and fund raising A USbased mult.pdf
q10 Euromarket investment and fund raising A USbased mult.pdfq10 Euromarket investment and fund raising A USbased mult.pdf
q10 Euromarket investment and fund raising A USbased mult.pdfadyardrpradeep
 
Q10 What is the value of the variable message in the foll.pdf
Q10 What is the value of the variable message in the foll.pdfQ10 What is the value of the variable message in the foll.pdf
Q10 What is the value of the variable message in the foll.pdfadyardrpradeep
 
Q10 Calculate return on capital when earnings before interes.pdf
Q10 Calculate return on capital when earnings before interes.pdfQ10 Calculate return on capital when earnings before interes.pdf
Q10 Calculate return on capital when earnings before interes.pdfadyardrpradeep
 
Q1 Write the genotype of an individual who is homozygous re.pdf
Q1 Write the genotype of an individual who is homozygous re.pdfQ1 Write the genotype of an individual who is homozygous re.pdf
Q1 Write the genotype of an individual who is homozygous re.pdfadyardrpradeep
 
Q1 Which of the following statements is true about perfectl.pdf
Q1 Which of the following statements is true about perfectl.pdfQ1 Which of the following statements is true about perfectl.pdf
Q1 Which of the following statements is true about perfectl.pdfadyardrpradeep
 
Q1 Use Breadth First Search to find the path from S to G .pdf
Q1 Use Breadth First Search to find the path from S to G .pdfQ1 Use Breadth First Search to find the path from S to G .pdf
Q1 Use Breadth First Search to find the path from S to G .pdfadyardrpradeep
 

More from adyardrpradeep (20)

Q1 Which of the following is NOT considered ossification co.pdf
Q1 Which of the following is NOT considered ossification co.pdfQ1 Which of the following is NOT considered ossification co.pdf
Q1 Which of the following is NOT considered ossification co.pdf
 
Q1 Your goal is to build a model to predict how people will.pdf
Q1 Your goal is to build a model to predict how people will.pdfQ1 Your goal is to build a model to predict how people will.pdf
Q1 Your goal is to build a model to predict how people will.pdf
 
Q24 Conduct a risk analysis and management process for the.pdf
Q24 Conduct a risk analysis and management process for the.pdfQ24 Conduct a risk analysis and management process for the.pdf
Q24 Conduct a risk analysis and management process for the.pdf
 
Q2 Design the pseudocode to print a binary tree At the vis.pdf
Q2 Design the pseudocode to print a binary tree At the vis.pdfQ2 Design the pseudocode to print a binary tree At the vis.pdf
Q2 Design the pseudocode to print a binary tree At the vis.pdf
 
Q2 Let X denote the amount of time for which a book onehou.pdf
Q2 Let X denote the amount of time for which a book onehou.pdfQ2 Let X denote the amount of time for which a book onehou.pdf
Q2 Let X denote the amount of time for which a book onehou.pdf
 
Q2 Given the total cost function Ca+bY with agt00ltb.pdf
Q2 Given the total cost function Ca+bY with agt00ltb.pdfQ2 Given the total cost function Ca+bY with agt00ltb.pdf
Q2 Given the total cost function Ca+bY with agt00ltb.pdf
 
Q2 A sample space S consists of five simple events with the.pdf
Q2 A sample space S consists of five simple events with the.pdfQ2 A sample space S consists of five simple events with the.pdf
Q2 A sample space S consists of five simple events with the.pdf
 
Q2 ClothsforYou plc is a medium sized UK listed interneton.pdf
Q2 ClothsforYou plc is a medium sized UK listed interneton.pdfQ2 ClothsforYou plc is a medium sized UK listed interneton.pdf
Q2 ClothsforYou plc is a medium sized UK listed interneton.pdf
 
Q1 Shale is a sedimentary rock a protolith of slate whic.pdf
Q1 Shale is a sedimentary rock a protolith of slate whic.pdfQ1 Shale is a sedimentary rock a protolith of slate whic.pdf
Q1 Shale is a sedimentary rock a protolith of slate whic.pdf
 
Q2 Mention whether the following instructions are right or.pdf
Q2  Mention whether the following instructions are right or.pdfQ2  Mention whether the following instructions are right or.pdf
Q2 Mention whether the following instructions are right or.pdf
 
Q2 5 marks An educational researcher believes that the me.pdf
Q2 5 marks An educational researcher believes that the me.pdfQ2 5 marks An educational researcher believes that the me.pdf
Q2 5 marks An educational researcher believes that the me.pdf
 
Q1 We read many accounts this week of what emerging indepen.pdf
Q1 We read many accounts this week of what emerging indepen.pdfQ1 We read many accounts this week of what emerging indepen.pdf
Q1 We read many accounts this week of what emerging indepen.pdf
 
Q1Unaudited information about significant events and uncer.pdf
Q1Unaudited information about significant events and uncer.pdfQ1Unaudited information about significant events and uncer.pdf
Q1Unaudited information about significant events and uncer.pdf
 
Q1413 What is the structure in coordinates J25 and J10 .pdf
Q1413 What is the structure in coordinates J25 and J10 .pdfQ1413 What is the structure in coordinates J25 and J10 .pdf
Q1413 What is the structure in coordinates J25 and J10 .pdf
 
q10 Euromarket investment and fund raising A USbased mult.pdf
q10 Euromarket investment and fund raising A USbased mult.pdfq10 Euromarket investment and fund raising A USbased mult.pdf
q10 Euromarket investment and fund raising A USbased mult.pdf
 
Q10 What is the value of the variable message in the foll.pdf
Q10 What is the value of the variable message in the foll.pdfQ10 What is the value of the variable message in the foll.pdf
Q10 What is the value of the variable message in the foll.pdf
 
Q10 Calculate return on capital when earnings before interes.pdf
Q10 Calculate return on capital when earnings before interes.pdfQ10 Calculate return on capital when earnings before interes.pdf
Q10 Calculate return on capital when earnings before interes.pdf
 
Q1 Write the genotype of an individual who is homozygous re.pdf
Q1 Write the genotype of an individual who is homozygous re.pdfQ1 Write the genotype of an individual who is homozygous re.pdf
Q1 Write the genotype of an individual who is homozygous re.pdf
 
Q1 Which of the following statements is true about perfectl.pdf
Q1 Which of the following statements is true about perfectl.pdfQ1 Which of the following statements is true about perfectl.pdf
Q1 Which of the following statements is true about perfectl.pdf
 
Q1 Use Breadth First Search to find the path from S to G .pdf
Q1 Use Breadth First Search to find the path from S to G .pdfQ1 Use Breadth First Search to find the path from S to G .pdf
Q1 Use Breadth First Search to find the path from S to G .pdf
 

Recently uploaded

SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxiammrhaywood
 
Concept of Vouching. B.Com(Hons) /B.Compdf
Concept of Vouching. B.Com(Hons) /B.CompdfConcept of Vouching. B.Com(Hons) /B.Compdf
Concept of Vouching. B.Com(Hons) /B.CompdfUmakantAnnand
 
Micromeritics - Fundamental and Derived Properties of Powders
Micromeritics - Fundamental and Derived Properties of PowdersMicromeritics - Fundamental and Derived Properties of Powders
Micromeritics - Fundamental and Derived Properties of PowdersChitralekhaTherkar
 
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptxContemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptxRoyAbrique
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfsanyamsingh5019
 
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
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3JemimahLaneBuaron
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)eniolaolutunde
 
Science 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its CharacteristicsScience 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its CharacteristicsKarinaGenton
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...EduSkills OECD
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Educationpboyjonauth
 
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Celine George
 
MENTAL STATUS EXAMINATION format.docx
MENTAL     STATUS EXAMINATION format.docxMENTAL     STATUS EXAMINATION format.docx
MENTAL STATUS EXAMINATION format.docxPoojaSen20
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeThiyagu K
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introductionMaksud Ahmed
 
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
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Krashi Coaching
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxNirmalaLoungPoorunde1
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxOH TEIK BIN
 

Recently uploaded (20)

SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
 
Concept of Vouching. B.Com(Hons) /B.Compdf
Concept of Vouching. B.Com(Hons) /B.CompdfConcept of Vouching. B.Com(Hons) /B.Compdf
Concept of Vouching. B.Com(Hons) /B.Compdf
 
Micromeritics - Fundamental and Derived Properties of Powders
Micromeritics - Fundamental and Derived Properties of PowdersMicromeritics - Fundamental and Derived Properties of Powders
Micromeritics - Fundamental and Derived Properties of Powders
 
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
 
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptxContemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdf
 
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
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)
 
Science 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its CharacteristicsScience 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its Characteristics
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Education
 
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
 
MENTAL STATUS EXAMINATION format.docx
MENTAL     STATUS EXAMINATION format.docxMENTAL     STATUS EXAMINATION format.docx
MENTAL STATUS EXAMINATION format.docx
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and Mode
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
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
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptx
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptx
 

Q1 Write a python function that gets a list as an input an.pdf

  • 1. Q1. Write a python function that get's a list as an input and the median of its values. Median is the middle number when you sort the list. If the list has even number of elements, median will be the average of the two numbers in the middle Example: median of [5,4,8,2,9,1,3] is 4 and median of [4 ,5,2,1,8,9] is (4+5)/2 or 4.5 . You can use python's own sorting algorithm. def find median (1st): Q2. Write a python function that gets n and returns the nth value in the Pell sequence. Pell sequence is defined by P(n)=2P(n1)+P(n2) while P(0)=0 and P(1)=1. Use your code to generate and provide the first 10 values of Pell sequence. def pell (n): Section 2 - function Analysis ( 30 marks) Q3. Run an analysis of the function developed in Q2 and find its T(n) and big O perforamance. Is finding the nth element of Pell sequence faster than bubble sort? Is it faster than finding the nth element of the Fibonacci series?