Posts

Showing posts with the label T-SCL

Merge_n_Insertion_sorting

// include file #include <condefs.h> #include <conio> #include <iostream> #include <fstream> //dibatasi memori 52 #define MAXLIST 52 #define MAXINT (int) (2147483647) using namespace std; //struktur data kita tetap dan fleksible typedef char item_type; typedef struct node_tag; {   Item_type info;   struct node_tag *next; } Node_type; typdedef struct list_ag {   Node_type *head;   Node_type *tail; } List_type; //prototype fungsi operasi pada link list void AddNode(List_type* ,Item_type , const int opt=0); void DeleteNode(List_type , Item_type); void Error (char*); bool ExtractLine(Item_type& , Item_type); void InitList(List_type* ); Node_type *MergeSort(Node_type *p); List_type *InsertionSort (List_type *); bool FindItem(const List_type* ,Item_type); void Transverse(const List_type* ,void (*Visit) (ItemType)); void Visit(Item_type); char Menu(void); void CopyList(const List_type *, List_type *); void BatchSort(List_type *list_ptr); //var gl...

Tugas_for_Aplro_DivideNconquer

#include <cstdlib> #include <iostream> using namespace std; void minmax2(int A[], int i, int j, int &min, int &max ){      /*      Mencari nilai maksimum dan minimum di dalam tabel A yang      berukuran n elemen secara Divide and Conquer.      Masukan: tabel A yang sudah terdefinisi elemen-elemennya      Keluaran: nilai maksimum dan nilai minimum tabel      */      int min1, min2, max1, max2,k;      if(i==j){               min=A[i];               max=A[i];               }      else if(i==j-1){           if(A[i]<A[j]){      ...