This repository has been archived on 2024-01-06. You can view files and clone it, but cannot push or open issues or pull requests.
justhomework/DataStructure/Code/ex03/vec.h

57 lines
687 B
C
Raw Normal View History

2021-10-08 09:17:16 +00:00
#ifndef _INC_STDIO
#include <stdio.h>
#endif
#ifndef _GLIBCXX_STDLIB_H
#include <stdlib.h>
#endif
#include <time.h>
class Vec
{
private:
int *_v;
int _len;
int _used;
bool _sorted = false;
void expand();
void shrink();
public:
Vec(int _len);
int get(int a);
int search(int value);
void put(int a, int value);
void swap(int a, int b);
int insert(int locate, int value);
int remove(int locate, int value);
int remove_sorted(int value);
int find(int value);
2021-10-15 07:20:32 +00:00
void bubbleSort();
2021-10-08 09:17:16 +00:00
void printall();
int getlen();
int getused();
int count(int value);
2021-10-15 07:20:32 +00:00
void mergeSort(int lo, int hi);
2021-10-08 09:17:16 +00:00
2021-10-15 07:20:32 +00:00
private:
void merge(int lo, int mi, int hi);
};