最近开始投简历了,技术美术,第一次笔试,不知道具体会考什么。听说有编程题,花了两天复习各路算法,最后编程题考了一道数据结构(单链表),两道图形学。前面选择都是专业课的内容(网络考数据链路层,子网掩码),偏简单的八股文。但是数据结构能忘的早就还给老师,带着悔恨的心。(昨天四点都没睡着,两点前都在罪恶消费,今早还有移动开发的课,一大写的悲)开始复习第一天选择快排,大小堆;程序单链表,链表。
  1. 快排(java,b站随便看的一个)
public class Main{static int[] arr={49,38,65,97,76,13,27,49};public static void main(String[] args) {Quick(arr,0,arr.length-1);for (int i=0;i<arr.length-1;i++){System.out.println(arr[i]);}}public static void Quick(int[] arr,int left,int right){if (arr==null||arr.length==0){return;}if (left>right){return;}int key=arr[left];int l=left;int r=right;while (l!=r){while (arr[r]>=key&&l<r){r--;}while (arr[l]<=key&&l<r){l++;}if (l<r){int temp=arr[l];arr[l]=arr[r];arr[r]=temp;}}arr[left]=arr[l];arr[l]=key;Quick(arr,left,l-1);Quick(arr,l+1,right);}
}
  1. 堆排序(C,灯哥)
//哈哈哈五个月没敲过C了
#include <stdio.h>
void swap(int arr[], int i, int j) {int temp = arr[i];arr[i] = arr[j];arr[j] = temp;
}
//一侧的一趟排序,n总数,i当前索引
void heapify(int tree[],int n,int i) {if (i>=n){//递归出口return;}//两个子节点索引int c1 = 2 * i + 1;int c2 = 2 * i + 2;int max = i;//<n子节点不能越界if (c1<n&&tree[c1]>tree[max]){max = c1;}if (c2<n&&tree[c2]>tree[max]){max = c2;}//如果最大不是当前节点,那就和子节点换if (max!=i){  //子节点的数大往上换swap(tree, max, i);//递归保证左子树或者右子树是堆heapify(tree, n, max);}
}
//保证tree是堆
void build_heap(int tree[],int n) {int last_node = n - 1;//最后一个点索引int parent = (last_node - 1) / 2;int i;for (i = parent; i >= 0; i--) {heapify(tree, n, i);}
}
//堆排序
void heap_sort(int tree[],int n) {build_heap(tree, n);for (int i=n-1;i>=0;i--){//n-1最后一个数与根节点交换(大顶堆,顶最大),剪枝swap(tree, i, 0);heapify(tree, i, 0);}
}
int main()
{int tree[] = { 8,6,9,10,36,89,8,77,5 };int n = sizeof(tree)/sizeof(int);heap_sort(tree, n);for (int i = 0; i < n; i++){printf("%d\n", tree[i]);}getchar();return 0;
}
  1. 单链表( C )
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <stdlib.h>
struct Node
{int data;//4struct Node *next;//指针4
};
//有一个头结点,一个尾节点
struct Node *head;
struct Node *create_link(struct Node *head, int l, int n)
{head = (struct Node *)malloc(sizeof(struct Node));//8head->next = NULL;struct Node *tail = head;for (int i = 0; i < l - 1; i++){struct Node *temp = (struct Node *)malloc(sizeof(struct Node));temp->data = i;temp->next = NULL;tail->next = temp;tail = temp;if (i == l - n -1){printf("倒数第%d个数值为%d\n",n,tail->data);}}return head;
};
void print_link(struct Node *head) {struct Node *p = head;p = p->next;while (p != NULL){printf("%d\n", p->data);p = p->next;}
}
//删除链表中=X的数据
void deleteALL(struct Node* head,int x) {struct Node *p, *q;p = head;while (p->next!=NULL){q = p->next;if (x==q->data){p->next = q->next;}if (q->next==NULL&&x==q->data){q = NULL;break;}p = q;}
}
//在位置i处插入数据elem
void Insert(struct Node *head, int i, int elem) {i = i + 1;//这里+1代表传入的i是索引位置,加不加都行struct Node *p, *q;p = head;int j = 0;while (p!=NULL&&j<i-1){//指针p与索引j同步j++;p = p->next;}if (p==NULL||j>i-1){printf("越界\n");return;}//j=i+1;同时p!=NULLq= (struct Node *)malloc(sizeof(struct Node));q->data = elem;q->next = p->next;p->next = q;
}
int main() {int l = 0, n = 0;scanf("%d %d", &l, &n);head = create_link(head, l, n);print_link(head);printf("删除\n");deleteALL(head, 8);print_link(head);printf("插入\n");Insert(head, 8, 8);print_link(head);getchar();return 0;
}
  1. 链表(java,图灵)
    题外话,写题的时候本来打算用java实现的分析分析着就蚌住了
//单链表 节点
public class ListNode {int val;ListNode next;public ListNode(int val) {this.val = val;}
}
//两个指针
public class LinkedList {ListNode head;ListNode tail;int size;public LinkedList() {head=null;tail=null;size=0;}//插入public void insert(int position,int number){if (position>number){return;}ListNode newNode=new ListNode(number);//空表if (position==0){newNode.next=head;head=newNode;if (tail==null){tail=newNode;}size++;}else if (position==size){append(number);}else{ListNode prev=head;for (int i = 0; i <position-1 ; i++) {prev=prev.next;}ListNode next=prev.next;newNode.next=next;prev.next=newNode;size++;}}//在链表尾部插入public void append(int number){//number插入的数值if (size==0){ListNode newNode=new ListNode(number);head=newNode;tail=head;size++;return;}ListNode newNode=new ListNode(number);if (tail==null){tail=newNode;}else {tail.next=newNode;tail=newNode;}size++;}//删除public void delete(int number){if (head!=null&&head.val==number){head=head.next;size--;if (size==0){//删完没有元素了tail=head;}}else {ListNode prev=head;ListNode cur=head;while (cur!=null&&prev!=null){if (cur.val==number){if (cur==tail){tail=prev;}prev.next=cur.next;size--;return;}prev=cur;cur=cur.next;}}}//查找public int search(int number){ListNode cur=head;for (int index = 0; cur!=null ; index++) {if (cur.val==number){return index;//返回索引}cur=cur.next;}return -1;}//更新public int updat(int oldValue,int newValue){ListNode cur=head;for (int index = 0; cur!=null ; index++) {if (cur.val==oldValue){cur.val=newValue;return index;//返回索引}cur=cur.next;}return -1;}public void display(){ListNode cur=head;while (cur!=null){System.out.print(cur.val+",");cur=cur.next;}}
}
public class Test {public static void main(String[] args) {LinkedList list=new LinkedList();list.insert(0,5);//list.append(5);list.append(6);//list.delete(6);//list.display();System.out.println(list.search(6));}
}
 岗位相关[UE面试看起来挺有用](https://www.bilibili.com/video/BV1Ka411C7xd?share_source=copy_web)

完事啦好困好困,下一家冲冲冲,何处是归途~

卑微-后知后觉查缺补漏1相关推荐

  1. 重新学习计算机基础理论知识(后知后觉)

    在写了几年代码之后,才知道有软考这样的考试存在:在写了很多逻辑之后,总是对计算机如何处理程序几无所知:在大学时学的东西完全没有了印象和记忆,程序一旦开始运行就好像丢进自动贩卖机的硬币一样再也看不到它的 ...

  2. 后知后觉-观sicp

    当我看到sicp P25里计算Fibnacci的一种迭代计算方法 a<-a+b b<-a 明显是错误的,或许我们应该只领会精神就可以了? 正确的应该是 tmp <- a+b b &l ...

  3. 这个世界依聪明才智的先天高下得三种人:先知先觉的发明家,后知后觉的宣传家,不知不觉的实践家...

    这个世界依聪明才智的先天高下得三种人:先知先觉的发明家,后知后觉的宣传家,不知不觉的实践家

  4. 亲述真实经历--“人工智能培训机构”的“坑”,希望更多像我这样的人不要吃了第一次亏才后知后觉

    作为有血泪教训,经历过两次人工智能培训,想转行到AI的人,揭露业界存在的陷阱,希望大家不要像我这样第一次吃亏了才后知后觉,大家一起交流学习,不要掉坑里! 当你去咨询培训机构并询问他们是否有真正的项目时 ...

  5. 那些程序员们后知后觉的职涯经验

    文/技匠(简书签约作者) 原文链接:http://www.jianshu.com/p/d9c232ed74e3 著作权归作者所有,转载请联系作者获得授权,并标注"简书签约作者". ...

  6. 赫斌老师数据结构视频查缺补漏笔记

    赫斌老师数据结构视频查缺补漏笔记 观看学习赫斌老师数据结构的视频,记录下自己之前学习这块内容时似懂非懂的知识,仅针对自己查缺补漏使用 视频链接:<郝斌老师数据结构自学视频> 1.指针的大小 ...

  7. I2C总线学习—查缺补漏—S3C2440的I2C控制器

    I2C总线学习-查缺补漏-S3C2440的I2C控制器                  学习了IIC总线协议的理论部分,觉得应该学习具体操作2440的IIC控制器,毕竟最终都是为了学习S3C2440 ...

  8. I2C总线学习—查缺补漏—应答信号ACK

    I2C总线学习-查缺补漏-应答信号ACK           IIC协议规定,当主机作为接收设备时,主机对最后一个字节不应答,以向发送设备(从设备)标识数据传送结束.这是因为每次传输都应得到应答信号后 ...

  9. 后知后觉者的学习方法

    注:这里的"后知后觉"者,指的是像我一样的在大学之前没有接触过程序设计的人或者是在想要入职程序员而没有任何基础的人. 一.学任何知识的先决条件 先不谈具体的学习方法,就学任何方面知 ...

最新文章

  1. 2017暑期挖坑计划(持续更新中~)
  2. jenkins打完包在哪里
  3. Windows下Memcached的安装与配置
  4. [itint5]棋盘漫步
  5. exists sql用法_SQL关于IN和EXISTS的用法和区别,读完之后,大部分程序员收藏了....
  6. 设置中文linux输入ubuntu,Linux_ubuntu怎么设置成中文?ubuntu中文设置图文方法,  很多朋友安装ubuntu后,发 - phpStudy...
  7. Python设置常量不可修改的办法
  8. sql 嵌套while需要注意的问题
  9. ROS的学习(十六)用C++写一个简单的服务器(service)和客户端(client)
  10. 计算机u盘序列号,注册表查询usb设备序列号,u盘电序列号注册表
  11. 旧的华为手机刷Android9,直播mate9刷安卓10!
  12. Windows 7 出现 0xc0000014c 注册表损坏 修复问题
  13. IDEA社区版详细安装2022最新版(保姆式)
  14. 大量用户反馈 QQ 账号被盗;​AirPods Pro2 或支持查找功能;Spring Boot 2.7.1发布|极客头条
  15. “领导力培训”纪要整理
  16. 服务器没有显示器能接笔记本吗,笔记本能连显示器吗,笔记本怎么才能接显示器(图文)...
  17. OPPO手机生日倒计时天数怎么在便签中设置?
  18. 详解 Java 常用的四种锁机制优缺点
  19. C++数独求解器与生成器
  20. java之缓存的使用

热门文章

  1. 【数据结构与算法综合实验】景区信息管理系统迭代开发
  2. layui的laydate实现季度选择
  3. Elasticsearch(ES)数据库模糊查询source下的数据
  4. TextView使用drawable属性
  5. arm系列交叉编译器各版本区别
  6. USB不同接口的速率峰值
  7. 富士康回击 爆黑幕记者资产遭法院冻结
  8. 短信平台API接口demo示例-Node/SMS/MultiSend
  9. 关于UrlRewrite的使用
  10. Linux之dstat命令