##bubble
rm(list = ls())
#vec<-c(2,5,3,9,6,1,7)
vec<-c(6,2,4,1,5,9)
bubblesort = function(vec){
n = length(vec)
for(i in 1:(n-1)) {
for(j in (i+1):n){
if(vec[i]>=vec[j]){
temp<-vec[i]
vec[i]<-vec[j]
vec[j]<-temp
}
}
}
return(vec)
}
bubblesort(vec)
##quick sort
quicksort = function(vector,small,big) { left = small
right = big
if(left >= right) {
return(vector)
} else {
markvalue<-vector[left]
while(left<right) {
while(left<right && vector[right]>=markvalue) {
right<-right-1
}
vector[left]<-vector[right]
while(left< right && vector[left]<=markvakue) {
&n
rm(list = ls())
#vec<-c(2,5,3,9,6,1,7)
vec<-c(6,2,4,1,5,9)
bubblesort = function(vec){
n = length(vec)
for(i in 1:(n-1)) {
for(j in (i+1):n){
if(vec[i]>=vec[j]){
temp<-vec[i]
vec[i]<-vec[j]
vec[j]<-temp
}
}
}
return(vec)
}
bubblesort(vec)
##quick sort
quicksort = function(vector,small,big) { left = small
right = big
if(left >= right) {
return(vector)
} else {
markvalue<-vector[left]
while(left<right) {
while(left<right && vector[right]>=markvalue) {
right<-right-1
}
vector[left]<-vector[right]
while(left< right && vector[left]<=markvakue) {
&n