当前位置:七七学习网文档大全求职指南求职笔试面试笔试题目部分IT公司笔试算法题» 正文

部分IT公司笔试算法题

[10-10 21:21:19]   来源:http://www.77xue.com  笔试题目   阅读:8903
概要:if(str!=c) str[j++]=str;str[j] = '\0';}int main(int argc, char* argv[]) {char str[] = "abcdefgh"; // 注意,此处不能写成char *str = "abcdefgh";printf("%s\n", str);delChar(str, 'c');printf("%s\n", str);}26、判断单链表中是否存在环(网上说的笔试题)#include "stdafx.h"typedef char eleType; // 定义链表中的数据类型typedef struct listnode { // 定义单链表结构eleType data;struct listnode *next;}node;node *create(int n) { // 创建单链表,n为节点个数n
部分IT公司笔试算法题,标签:驾照笔试题目,腾讯笔试题目,http://www.77xue.com

  if(str!=c) str[j++]=str;

  str[j] = '\0';

  }

  int main(int argc, char* argv[]) {

  char str[] = "abcdefgh"; // 注意,此处不能写成char *str = "abcdefgh";

  printf("%s\n", str);

  delChar(str, 'c');

  printf("%s\n", str);

  }

  26、判断单链表中是否存在环(网上说的笔试题)

  #include "stdafx.h"

  typedef char eleType; // 定义链表中的数据类型

  typedef struct listnode { // 定义单链表结构

  eleType data;

  struct listnode *next;

  }node;

  node *create(int n) { // 创建单链表,n为节点个数

  node *p = (node *)malloc(sizeof(node));

  node *head = p; head->data = 'A';

  for(int i='B'; i<'A'+n; i++) {

  p = (p->next = (node *)malloc(sizeof(node)));

  p->data = i;

  p->next = NULL;

  }

  return head;

  }

  void addCircle(node *head, int n) { // 增加环,将链尾指向链中第n个节点

  node *q, *p = head;

  for(int i=1; p->next; i++) {

  if(i==n) q = p;

  p = p->next;

  }

  p->next = q;

  }

  int isCircle(node *head) { // 这是笔试时需要写的最主要函数,其他函数可以不写

  node *p=head,*q=head;

  while( p->next && q->next) {

  p = p->next;

  if (NULL == (q=q->next->next)) return 0;

  if (p == q) return 1;

  }

  return 0;

  }

  int main(int argc, char* argv[]) {

  node *head = create(12);

  addCircle(head, 8); // 注释掉此行,连表就没有环了

  printf("%d\n", isCircle(head));

  }

上一页  [1] [2] [3] [4] [5] [6] [7] [8] [9] 


Tag:笔试题目驾照笔试题目,腾讯笔试题目求职指南 - 求职笔试面试 - 笔试题目

《部分IT公司笔试算法题》相关文章

联系我们 | 网站地图 | 范文大全 | 管理知识 | 教学教育 | 作文大全 | 语句好词
Copyright http://www.77xue.com--(七七学习网) All Right Reserved.
1 2 3 4 5 6 7 8 9 10