SlideShare a Scribd company logo
1 of 3
Download to read offline
import java.awt.LinearGradientPaint;
public class searchComparision {
/**
* @param args
*/
public static void linearSearch(int arr[],int n)
{
for(int i =0;i=n)
{
break;
}
}
System.out.println("");
}
static void binarySearch(int arr[],int start,int end,int n)
{
if(endn)
{
binarySearch(arr, start,mid-1,n);
}
else
{
binarySearch(arr,mid+1,end,n);
}
return;
}
public static void main(String[] args) {
// TODO Auto-generated method stub
int arr[] = {4,8,12,23,54,84,89,110};
int n=8;
linearSearch(arr,n);
binarySearch(arr,0,arr.length-1,n);
n=33;
linearSearch(arr,n);
binarySearch(arr,0,arr.length-1,n);
n=84;
linearSearch(arr,n);
binarySearch(arr,0,arr.length-1,n);
}
}
Solution
import java.awt.LinearGradientPaint;
public class searchComparision {
/**
* @param args
*/
public static void linearSearch(int arr[],int n)
{
for(int i =0;i=n)
{
break;
}
}
System.out.println("");
}
static void binarySearch(int arr[],int start,int end,int n)
{
if(endn)
{
binarySearch(arr, start,mid-1,n);
}
else
{
binarySearch(arr,mid+1,end,n);
}
return;
}
public static void main(String[] args) {
// TODO Auto-generated method stub
int arr[] = {4,8,12,23,54,84,89,110};
int n=8;
linearSearch(arr,n);
binarySearch(arr,0,arr.length-1,n);
n=33;
linearSearch(arr,n);
binarySearch(arr,0,arr.length-1,n);
n=84;
linearSearch(arr,n);
binarySearch(arr,0,arr.length-1,n);
}
}

More Related Content

Similar to import java.awt.LinearGradientPaint; public class searchComparis.pdf

OrderTest.javapublic class OrderTest {       Get an arra.pdf
OrderTest.javapublic class OrderTest {         Get an arra.pdfOrderTest.javapublic class OrderTest {         Get an arra.pdf
OrderTest.javapublic class OrderTest {       Get an arra.pdfakkhan101
 
import java.util.Scanner;class BinaryNode{     BinaryNode left.pdf
import java.util.Scanner;class BinaryNode{     BinaryNode left.pdfimport java.util.Scanner;class BinaryNode{     BinaryNode left.pdf
import java.util.Scanner;class BinaryNode{     BinaryNode left.pdfshaktisinhgandhinaga
 
Basic java, java collection Framework and Date Time API
Basic java, java collection Framework and Date Time APIBasic java, java collection Framework and Date Time API
Basic java, java collection Framework and Date Time APIjagriti srivastava
 
Java 5 New Feature
Java 5 New FeatureJava 5 New Feature
Java 5 New Featurexcoda
 
Computer java programs
Computer java programsComputer java programs
Computer java programsADITYA BHARTI
 
Java AssignmentWrite a program using sortingsorting bubble,sele.pdf
Java AssignmentWrite a program using sortingsorting bubble,sele.pdfJava AssignmentWrite a program using sortingsorting bubble,sele.pdf
Java AssignmentWrite a program using sortingsorting bubble,sele.pdfeyewatchsystems
 
CodeCamp Iasi 10 march 2012 - Practical Groovy
CodeCamp Iasi 10 march 2012 - Practical GroovyCodeCamp Iasi 10 march 2012 - Practical Groovy
CodeCamp Iasi 10 march 2012 - Practical GroovyCodecamp Romania
 
Algoritmos sujei
Algoritmos sujeiAlgoritmos sujei
Algoritmos sujeigersonjack
 
QA Auotmation Java programs,theory
QA Auotmation Java programs,theory QA Auotmation Java programs,theory
QA Auotmation Java programs,theory archana singh
 
WINSEM2020-21_STS3105_SS_VL2020210500169_Reference_Material_I_15-Feb-2021_L6-...
WINSEM2020-21_STS3105_SS_VL2020210500169_Reference_Material_I_15-Feb-2021_L6-...WINSEM2020-21_STS3105_SS_VL2020210500169_Reference_Material_I_15-Feb-2021_L6-...
WINSEM2020-21_STS3105_SS_VL2020210500169_Reference_Material_I_15-Feb-2021_L6-...MaruMengesha
 
Evolving with Java - How to Remain Effective
Evolving with Java - How to Remain EffectiveEvolving with Java - How to Remain Effective
Evolving with Java - How to Remain EffectiveNaresha K
 

Similar to import java.awt.LinearGradientPaint; public class searchComparis.pdf (19)

OrderTest.javapublic class OrderTest {       Get an arra.pdf
OrderTest.javapublic class OrderTest {         Get an arra.pdfOrderTest.javapublic class OrderTest {         Get an arra.pdf
OrderTest.javapublic class OrderTest {       Get an arra.pdf
 
import java.util.Scanner;class BinaryNode{     BinaryNode left.pdf
import java.util.Scanner;class BinaryNode{     BinaryNode left.pdfimport java.util.Scanner;class BinaryNode{     BinaryNode left.pdf
import java.util.Scanner;class BinaryNode{     BinaryNode left.pdf
 
Basic java, java collection Framework and Date Time API
Basic java, java collection Framework and Date Time APIBasic java, java collection Framework and Date Time API
Basic java, java collection Framework and Date Time API
 
Java 5 New Feature
Java 5 New FeatureJava 5 New Feature
Java 5 New Feature
 
Java 5 Features
Java 5 FeaturesJava 5 Features
Java 5 Features
 
Problemas secuenciales.
Problemas secuenciales.Problemas secuenciales.
Problemas secuenciales.
 
Problemas secuenciales.
Problemas secuenciales.Problemas secuenciales.
Problemas secuenciales.
 
Problemas secuenciales.
Problemas secuenciales.Problemas secuenciales.
Problemas secuenciales.
 
Problemas secuenciales.
Problemas secuenciales.Problemas secuenciales.
Problemas secuenciales.
 
Problemas secuenciales.
Problemas secuenciales.Problemas secuenciales.
Problemas secuenciales.
 
Computer java programs
Computer java programsComputer java programs
Computer java programs
 
Java AssignmentWrite a program using sortingsorting bubble,sele.pdf
Java AssignmentWrite a program using sortingsorting bubble,sele.pdfJava AssignmentWrite a program using sortingsorting bubble,sele.pdf
Java AssignmentWrite a program using sortingsorting bubble,sele.pdf
 
CodeCamp Iasi 10 march 2012 - Practical Groovy
CodeCamp Iasi 10 march 2012 - Practical GroovyCodeCamp Iasi 10 march 2012 - Practical Groovy
CodeCamp Iasi 10 march 2012 - Practical Groovy
 
Algoritmos sujei
Algoritmos sujeiAlgoritmos sujei
Algoritmos sujei
 
Estructura secuencial -garcia
Estructura secuencial -garciaEstructura secuencial -garcia
Estructura secuencial -garcia
 
PRACTICAL COMPUTING
PRACTICAL COMPUTINGPRACTICAL COMPUTING
PRACTICAL COMPUTING
 
QA Auotmation Java programs,theory
QA Auotmation Java programs,theory QA Auotmation Java programs,theory
QA Auotmation Java programs,theory
 
WINSEM2020-21_STS3105_SS_VL2020210500169_Reference_Material_I_15-Feb-2021_L6-...
WINSEM2020-21_STS3105_SS_VL2020210500169_Reference_Material_I_15-Feb-2021_L6-...WINSEM2020-21_STS3105_SS_VL2020210500169_Reference_Material_I_15-Feb-2021_L6-...
WINSEM2020-21_STS3105_SS_VL2020210500169_Reference_Material_I_15-Feb-2021_L6-...
 
Evolving with Java - How to Remain Effective
Evolving with Java - How to Remain EffectiveEvolving with Java - How to Remain Effective
Evolving with Java - How to Remain Effective
 

More from anugrahafancy

X has +2 charge It has low first and second ioniz.pdf
                     X has +2 charge It has low first and second ioniz.pdf                     X has +2 charge It has low first and second ioniz.pdf
X has +2 charge It has low first and second ioniz.pdfanugrahafancy
 
Valence Bond Theory According to valence band the.pdf
                     Valence Bond Theory According to valence band the.pdf                     Valence Bond Theory According to valence band the.pdf
Valence Bond Theory According to valence band the.pdfanugrahafancy
 
total volume =25+25=50 ml total millimoles of KI=.pdf
                     total volume =25+25=50 ml total millimoles of KI=.pdf                     total volume =25+25=50 ml total millimoles of KI=.pdf
total volume =25+25=50 ml total millimoles of KI=.pdfanugrahafancy
 
This type of deformation is irreversible. However.pdf
                     This type of deformation is irreversible. However.pdf                     This type of deformation is irreversible. However.pdf
This type of deformation is irreversible. However.pdfanugrahafancy
 
Some elements receive their respective symbol bas.pdf
                     Some elements receive their respective symbol bas.pdf                     Some elements receive their respective symbol bas.pdf
Some elements receive their respective symbol bas.pdfanugrahafancy
 
phosphonium ylide is produced when phosphonium ha.pdf
                     phosphonium ylide is produced when phosphonium ha.pdf                     phosphonium ylide is produced when phosphonium ha.pdf
phosphonium ylide is produced when phosphonium ha.pdfanugrahafancy
 
N1 V1 = N2 V2 50 x M1 = 1.50 x 2 x 17.7 M M1 = 1..pdf
                     N1 V1 = N2 V2 50 x M1 = 1.50 x 2 x 17.7 M M1 = 1..pdf                     N1 V1 = N2 V2 50 x M1 = 1.50 x 2 x 17.7 M M1 = 1..pdf
N1 V1 = N2 V2 50 x M1 = 1.50 x 2 x 17.7 M M1 = 1..pdfanugrahafancy
 
In chemistry, an amphoteric species is a molecule.pdf
                     In chemistry, an amphoteric species is a molecule.pdf                     In chemistry, an amphoteric species is a molecule.pdf
In chemistry, an amphoteric species is a molecule.pdfanugrahafancy
 
Chemistry is the science of matter, especially it.pdf
                     Chemistry is the science of matter, especially it.pdf                     Chemistry is the science of matter, especially it.pdf
Chemistry is the science of matter, especially it.pdfanugrahafancy
 
Before this confederates began their general advance, General Lee pl.pdf
Before this confederates began their general advance, General Lee pl.pdfBefore this confederates began their general advance, General Lee pl.pdf
Before this confederates began their general advance, General Lee pl.pdfanugrahafancy
 
An understanding of periodic trends is important .pdf
                     An understanding of periodic trends is important .pdf                     An understanding of periodic trends is important .pdf
An understanding of periodic trends is important .pdfanugrahafancy
 
Acid contains hydrogen ions. Thus, iodate will re.pdf
                     Acid contains hydrogen ions. Thus, iodate will re.pdf                     Acid contains hydrogen ions. Thus, iodate will re.pdf
Acid contains hydrogen ions. Thus, iodate will re.pdfanugrahafancy
 
There is a difference between to connect to a network and to communi.pdf
There is a difference between to connect to a network and to communi.pdfThere is a difference between to connect to a network and to communi.pdf
There is a difference between to connect to a network and to communi.pdfanugrahafancy
 
The picture is not uploaded properly it is corrupted. please upload .pdf
The picture is not uploaded properly it is corrupted. please upload .pdfThe picture is not uploaded properly it is corrupted. please upload .pdf
The picture is not uploaded properly it is corrupted. please upload .pdfanugrahafancy
 
No clarity in question . Not visibleSolutionNo clarity in ques.pdf
No clarity in question . Not visibleSolutionNo clarity in ques.pdfNo clarity in question . Not visibleSolutionNo clarity in ques.pdf
No clarity in question . Not visibleSolutionNo clarity in ques.pdfanugrahafancy
 
Date Account title Debit credit jan 30 cash 45000 common sto.pdf
    Date Account title Debit credit   jan 30 cash 45000     common sto.pdf    Date Account title Debit credit   jan 30 cash 45000     common sto.pdf
Date Account title Debit credit jan 30 cash 45000 common sto.pdfanugrahafancy
 
Initial Value=2.5Drift rate per annum=0.4Variance rate per annum.pdf
Initial Value=2.5Drift rate per annum=0.4Variance rate per annum.pdfInitial Value=2.5Drift rate per annum=0.4Variance rate per annum.pdf
Initial Value=2.5Drift rate per annum=0.4Variance rate per annum.pdfanugrahafancy
 
IntroductionDarwin argused that living organisms evolved from one .pdf
IntroductionDarwin argused that living organisms evolved from one .pdfIntroductionDarwin argused that living organisms evolved from one .pdf
IntroductionDarwin argused that living organisms evolved from one .pdfanugrahafancy
 
Distance VectorLink StateIt Sends the entire routing tableIt S.pdf
Distance VectorLink StateIt Sends the entire routing tableIt S.pdfDistance VectorLink StateIt Sends the entire routing tableIt S.pdf
Distance VectorLink StateIt Sends the entire routing tableIt S.pdfanugrahafancy
 

More from anugrahafancy (20)

X has +2 charge It has low first and second ioniz.pdf
                     X has +2 charge It has low first and second ioniz.pdf                     X has +2 charge It has low first and second ioniz.pdf
X has +2 charge It has low first and second ioniz.pdf
 
Valence Bond Theory According to valence band the.pdf
                     Valence Bond Theory According to valence band the.pdf                     Valence Bond Theory According to valence band the.pdf
Valence Bond Theory According to valence band the.pdf
 
total volume =25+25=50 ml total millimoles of KI=.pdf
                     total volume =25+25=50 ml total millimoles of KI=.pdf                     total volume =25+25=50 ml total millimoles of KI=.pdf
total volume =25+25=50 ml total millimoles of KI=.pdf
 
This type of deformation is irreversible. However.pdf
                     This type of deformation is irreversible. However.pdf                     This type of deformation is irreversible. However.pdf
This type of deformation is irreversible. However.pdf
 
stereoisomers .pdf
                     stereoisomers                                    .pdf                     stereoisomers                                    .pdf
stereoisomers .pdf
 
Some elements receive their respective symbol bas.pdf
                     Some elements receive their respective symbol bas.pdf                     Some elements receive their respective symbol bas.pdf
Some elements receive their respective symbol bas.pdf
 
phosphonium ylide is produced when phosphonium ha.pdf
                     phosphonium ylide is produced when phosphonium ha.pdf                     phosphonium ylide is produced when phosphonium ha.pdf
phosphonium ylide is produced when phosphonium ha.pdf
 
N1 V1 = N2 V2 50 x M1 = 1.50 x 2 x 17.7 M M1 = 1..pdf
                     N1 V1 = N2 V2 50 x M1 = 1.50 x 2 x 17.7 M M1 = 1..pdf                     N1 V1 = N2 V2 50 x M1 = 1.50 x 2 x 17.7 M M1 = 1..pdf
N1 V1 = N2 V2 50 x M1 = 1.50 x 2 x 17.7 M M1 = 1..pdf
 
In chemistry, an amphoteric species is a molecule.pdf
                     In chemistry, an amphoteric species is a molecule.pdf                     In chemistry, an amphoteric species is a molecule.pdf
In chemistry, an amphoteric species is a molecule.pdf
 
Chemistry is the science of matter, especially it.pdf
                     Chemistry is the science of matter, especially it.pdf                     Chemistry is the science of matter, especially it.pdf
Chemistry is the science of matter, especially it.pdf
 
Before this confederates began their general advance, General Lee pl.pdf
Before this confederates began their general advance, General Lee pl.pdfBefore this confederates began their general advance, General Lee pl.pdf
Before this confederates began their general advance, General Lee pl.pdf
 
An understanding of periodic trends is important .pdf
                     An understanding of periodic trends is important .pdf                     An understanding of periodic trends is important .pdf
An understanding of periodic trends is important .pdf
 
Acid contains hydrogen ions. Thus, iodate will re.pdf
                     Acid contains hydrogen ions. Thus, iodate will re.pdf                     Acid contains hydrogen ions. Thus, iodate will re.pdf
Acid contains hydrogen ions. Thus, iodate will re.pdf
 
There is a difference between to connect to a network and to communi.pdf
There is a difference between to connect to a network and to communi.pdfThere is a difference between to connect to a network and to communi.pdf
There is a difference between to connect to a network and to communi.pdf
 
The picture is not uploaded properly it is corrupted. please upload .pdf
The picture is not uploaded properly it is corrupted. please upload .pdfThe picture is not uploaded properly it is corrupted. please upload .pdf
The picture is not uploaded properly it is corrupted. please upload .pdf
 
No clarity in question . Not visibleSolutionNo clarity in ques.pdf
No clarity in question . Not visibleSolutionNo clarity in ques.pdfNo clarity in question . Not visibleSolutionNo clarity in ques.pdf
No clarity in question . Not visibleSolutionNo clarity in ques.pdf
 
Date Account title Debit credit jan 30 cash 45000 common sto.pdf
    Date Account title Debit credit   jan 30 cash 45000     common sto.pdf    Date Account title Debit credit   jan 30 cash 45000     common sto.pdf
Date Account title Debit credit jan 30 cash 45000 common sto.pdf
 
Initial Value=2.5Drift rate per annum=0.4Variance rate per annum.pdf
Initial Value=2.5Drift rate per annum=0.4Variance rate per annum.pdfInitial Value=2.5Drift rate per annum=0.4Variance rate per annum.pdf
Initial Value=2.5Drift rate per annum=0.4Variance rate per annum.pdf
 
IntroductionDarwin argused that living organisms evolved from one .pdf
IntroductionDarwin argused that living organisms evolved from one .pdfIntroductionDarwin argused that living organisms evolved from one .pdf
IntroductionDarwin argused that living organisms evolved from one .pdf
 
Distance VectorLink StateIt Sends the entire routing tableIt S.pdf
Distance VectorLink StateIt Sends the entire routing tableIt S.pdfDistance VectorLink StateIt Sends the entire routing tableIt S.pdf
Distance VectorLink StateIt Sends the entire routing tableIt S.pdf
 

Recently uploaded

TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...
TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...
TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...Nguyen Thanh Tu Collection
 
Graduate Outcomes Presentation Slides - English (v3).pptx
Graduate Outcomes Presentation Slides - English (v3).pptxGraduate Outcomes Presentation Slides - English (v3).pptx
Graduate Outcomes Presentation Slides - English (v3).pptxneillewis46
 
When Quality Assurance Meets Innovation in Higher Education - Report launch w...
When Quality Assurance Meets Innovation in Higher Education - Report launch w...When Quality Assurance Meets Innovation in Higher Education - Report launch w...
When Quality Assurance Meets Innovation in Higher Education - Report launch w...Gary Wood
 
會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽
會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽
會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽中 央社
 
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptxCOMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptxannathomasp01
 
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...EADTU
 
An overview of the various scriptures in Hinduism
An overview of the various scriptures in HinduismAn overview of the various scriptures in Hinduism
An overview of the various scriptures in HinduismDabee Kamal
 
OSCM Unit 2_Operations Processes & Systems
OSCM Unit 2_Operations Processes & SystemsOSCM Unit 2_Operations Processes & Systems
OSCM Unit 2_Operations Processes & SystemsSandeep D Chaudhary
 
SURVEY I created for uni project research
SURVEY I created for uni project researchSURVEY I created for uni project research
SURVEY I created for uni project researchCaitlinCummins3
 
Spellings Wk 4 and Wk 5 for Grade 4 at CAPS
Spellings Wk 4 and Wk 5 for Grade 4 at CAPSSpellings Wk 4 and Wk 5 for Grade 4 at CAPS
Spellings Wk 4 and Wk 5 for Grade 4 at CAPSAnaAcapella
 
diagnosting testing bsc 2nd sem.pptx....
diagnosting testing bsc 2nd sem.pptx....diagnosting testing bsc 2nd sem.pptx....
diagnosting testing bsc 2nd sem.pptx....Ritu480198
 
Analyzing and resolving a communication crisis in Dhaka textiles LTD.pptx
Analyzing and resolving a communication crisis in Dhaka textiles LTD.pptxAnalyzing and resolving a communication crisis in Dhaka textiles LTD.pptx
Analyzing and resolving a communication crisis in Dhaka textiles LTD.pptxLimon Prince
 
TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...
TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...
TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...Nguyen Thanh Tu Collection
 
UChicago CMSC 23320 - The Best Commit Messages of 2024
UChicago CMSC 23320 - The Best Commit Messages of 2024UChicago CMSC 23320 - The Best Commit Messages of 2024
UChicago CMSC 23320 - The Best Commit Messages of 2024Borja Sotomayor
 
Contoh Aksi Nyata Refleksi Diri ( NUR ).pdf
Contoh Aksi Nyata Refleksi Diri ( NUR ).pdfContoh Aksi Nyata Refleksi Diri ( NUR ).pdf
Contoh Aksi Nyata Refleksi Diri ( NUR ).pdfcupulin
 
Improved Approval Flow in Odoo 17 Studio App
Improved Approval Flow in Odoo 17 Studio AppImproved Approval Flow in Odoo 17 Studio App
Improved Approval Flow in Odoo 17 Studio AppCeline George
 
Stl Algorithms in C++ jjjjjjjjjjjjjjjjjj
Stl Algorithms in C++ jjjjjjjjjjjjjjjjjjStl Algorithms in C++ jjjjjjjjjjjjjjjjjj
Stl Algorithms in C++ jjjjjjjjjjjjjjjjjjMohammed Sikander
 
8 Tips for Effective Working Capital Management
8 Tips for Effective Working Capital Management8 Tips for Effective Working Capital Management
8 Tips for Effective Working Capital ManagementMBA Assignment Experts
 

Recently uploaded (20)

OS-operating systems- ch05 (CPU Scheduling) ...
OS-operating systems- ch05 (CPU Scheduling) ...OS-operating systems- ch05 (CPU Scheduling) ...
OS-operating systems- ch05 (CPU Scheduling) ...
 
TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...
TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...
TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...
 
Graduate Outcomes Presentation Slides - English (v3).pptx
Graduate Outcomes Presentation Slides - English (v3).pptxGraduate Outcomes Presentation Slides - English (v3).pptx
Graduate Outcomes Presentation Slides - English (v3).pptx
 
When Quality Assurance Meets Innovation in Higher Education - Report launch w...
When Quality Assurance Meets Innovation in Higher Education - Report launch w...When Quality Assurance Meets Innovation in Higher Education - Report launch w...
When Quality Assurance Meets Innovation in Higher Education - Report launch w...
 
會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽
會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽
會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽
 
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptxCOMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
 
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
 
An overview of the various scriptures in Hinduism
An overview of the various scriptures in HinduismAn overview of the various scriptures in Hinduism
An overview of the various scriptures in Hinduism
 
OSCM Unit 2_Operations Processes & Systems
OSCM Unit 2_Operations Processes & SystemsOSCM Unit 2_Operations Processes & Systems
OSCM Unit 2_Operations Processes & Systems
 
Mattingly "AI and Prompt Design: LLMs with NER"
Mattingly "AI and Prompt Design: LLMs with NER"Mattingly "AI and Prompt Design: LLMs with NER"
Mattingly "AI and Prompt Design: LLMs with NER"
 
SURVEY I created for uni project research
SURVEY I created for uni project researchSURVEY I created for uni project research
SURVEY I created for uni project research
 
Spellings Wk 4 and Wk 5 for Grade 4 at CAPS
Spellings Wk 4 and Wk 5 for Grade 4 at CAPSSpellings Wk 4 and Wk 5 for Grade 4 at CAPS
Spellings Wk 4 and Wk 5 for Grade 4 at CAPS
 
diagnosting testing bsc 2nd sem.pptx....
diagnosting testing bsc 2nd sem.pptx....diagnosting testing bsc 2nd sem.pptx....
diagnosting testing bsc 2nd sem.pptx....
 
Analyzing and resolving a communication crisis in Dhaka textiles LTD.pptx
Analyzing and resolving a communication crisis in Dhaka textiles LTD.pptxAnalyzing and resolving a communication crisis in Dhaka textiles LTD.pptx
Analyzing and resolving a communication crisis in Dhaka textiles LTD.pptx
 
TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...
TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...
TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...
 
UChicago CMSC 23320 - The Best Commit Messages of 2024
UChicago CMSC 23320 - The Best Commit Messages of 2024UChicago CMSC 23320 - The Best Commit Messages of 2024
UChicago CMSC 23320 - The Best Commit Messages of 2024
 
Contoh Aksi Nyata Refleksi Diri ( NUR ).pdf
Contoh Aksi Nyata Refleksi Diri ( NUR ).pdfContoh Aksi Nyata Refleksi Diri ( NUR ).pdf
Contoh Aksi Nyata Refleksi Diri ( NUR ).pdf
 
Improved Approval Flow in Odoo 17 Studio App
Improved Approval Flow in Odoo 17 Studio AppImproved Approval Flow in Odoo 17 Studio App
Improved Approval Flow in Odoo 17 Studio App
 
Stl Algorithms in C++ jjjjjjjjjjjjjjjjjj
Stl Algorithms in C++ jjjjjjjjjjjjjjjjjjStl Algorithms in C++ jjjjjjjjjjjjjjjjjj
Stl Algorithms in C++ jjjjjjjjjjjjjjjjjj
 
8 Tips for Effective Working Capital Management
8 Tips for Effective Working Capital Management8 Tips for Effective Working Capital Management
8 Tips for Effective Working Capital Management
 

import java.awt.LinearGradientPaint; public class searchComparis.pdf

  • 1. import java.awt.LinearGradientPaint; public class searchComparision { /** * @param args */ public static void linearSearch(int arr[],int n) { for(int i =0;i=n) { break; } } System.out.println(""); } static void binarySearch(int arr[],int start,int end,int n) { if(endn) { binarySearch(arr, start,mid-1,n); } else { binarySearch(arr,mid+1,end,n); } return; } public static void main(String[] args) { // TODO Auto-generated method stub int arr[] = {4,8,12,23,54,84,89,110}; int n=8; linearSearch(arr,n); binarySearch(arr,0,arr.length-1,n);
  • 2. n=33; linearSearch(arr,n); binarySearch(arr,0,arr.length-1,n); n=84; linearSearch(arr,n); binarySearch(arr,0,arr.length-1,n); } } Solution import java.awt.LinearGradientPaint; public class searchComparision { /** * @param args */ public static void linearSearch(int arr[],int n) { for(int i =0;i=n) { break; } } System.out.println(""); } static void binarySearch(int arr[],int start,int end,int n) { if(endn) { binarySearch(arr, start,mid-1,n); } else { binarySearch(arr,mid+1,end,n);
  • 3. } return; } public static void main(String[] args) { // TODO Auto-generated method stub int arr[] = {4,8,12,23,54,84,89,110}; int n=8; linearSearch(arr,n); binarySearch(arr,0,arr.length-1,n); n=33; linearSearch(arr,n); binarySearch(arr,0,arr.length-1,n); n=84; linearSearch(arr,n); binarySearch(arr,0,arr.length-1,n); } }