This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let sammy = { | |
firstName: "Sammy", | |
lastName: "Shark", | |
color: "blue", | |
location: "Ocean" | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let sammy = {firstName:"Sammy", lastName:"Shark", color:"blue", location:"ocean"}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let fish = ["shark", "cuttlefish", "clownfish", "eel"]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script> | |
let hw = "Hello, World!"; | |
function helloFunction() { | |
alert(hw); | |
} | |
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE HTML> | |
<html> | |
<head> | |
<script> | |
function helloFunction() { | |
alert("Hello, World!"); | |
} | |
</script> | |
</head> | |
<body> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
while (num9 != Infinity) { | |
// Code here will execute through num9 = Infinity | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int rand_partition ( int A[ ] , int start , int end ) { | |
//chooses position of pivot randomly by using rand() function . | |
int random = start + rand( )%(end-start +1 ) ; | |
swap ( A[random] , A[start]) ; //swap pivot with 1st element. | |
return partition(A,start ,end) ; //call the above partition function | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void quick_sort ( int A[ ] ,int start , int end ) { | |
if( start < end ) { | |
//stores the position of pivot element | |
int piv_pos = partition (A,start , end ) ; | |
quick_sort (A,start , piv_pos -1); //sorts the left side of pivot. | |
quick_sort ( A,piv_pos +1 , end) ; //sorts the right side of pivot. | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int partition ( int A[],int start ,int end) { | |
int i = start + 1; | |
int piv = A[start] ; //make the first element as pivot element. | |
for(int j =start + 1; j <= end ; j++ ) { | |
/*rearrange the array by putting elements which are less than pivot | |
on one side and which are greater that on other. */ | |
if ( A[ j ] < piv) { | |
swap (A[ i ],A [ j ]); | |
i += 1; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void insertion_sort ( int A[ ] , int n) | |
{ | |
for( int i = 0 ;i < n ; i++ ) { | |
/*storing current element whose left side is checked for its | |
correct position .*/ | |
int temp = A[ i ]; | |
int j = i; | |
/* check whether the adjacent element in left side is greater or |
NewerOlder