-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMATRIZ.go
More file actions
55 lines (39 loc) · 892 Bytes
/
MATRIZ.go
File metadata and controls
55 lines (39 loc) · 892 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
package main
import (
"fmt"
"sync"
"time"
)
func ORDENAR(array []int, inicio int, fin int)[]int{
for x := 0; x < fin; x++ {
temp:=array[i]
for y := 0; y < fin; y++ {
if(temp<array[y]){
temp=array[y]
array[y]=array[x]
array[x]=temp
}
}
}
var tem int
for x := inicio; x < fin; x++ {
tem=array[x]
array_div[x] = tem
}
time.Sleep( 500*time.Millisecond)
return array_div
}
func main() {
array:=[]int{7,2,8,7,2,4,9,7,4,2,9,1,3,5,8,3}
var wg sync.WaitGroup
wg.Add(1)
go func() {
fmt.Println("matriz 1 ",ORDENAR(array,0,4))
fmt.Println("matriz 2 ",ORDENAR(array,4,8))
fmt.Println("matriz 3 ",ORDENAR(array,8,12))
fmt.Println("matriz 4 ",ORDENAR(array,12,16))
fmt.Println("matriz general",ORDENAR(array,0,len(array)))
wg.Done()
}()
wg.Wait()
}