![](https://img-blog.csdnimg.cn/20201014180756927.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
数据结构和算法
eclipse_c
游戏程序员
展开
-
Single Number II【leetcode】
跟上一个题目很类似,zhib原创 2014-09-21 23:07:33 · 601 阅读 · 0 评论 -
游戏设计中排行榜的设计和位运算的巧用
本文为作者原创,如需转载请标注出处。 http://blog.csdn.net/eclipse_c在游戏中有各种各样的排行榜需求,比如按照战斗力来进行排行,如果战力相同,那么就比较玩家等级,等等。下面介绍一种排行榜的设计,排名依据有多个字段,如:等级>战力>声望简单说下需求:宗门分为正派邪派,女宗。其中女宗也分正邪,只是多出来的一个字段来标识女性角色。正原创 2016-06-12 17:58:29 · 1950 阅读 · 0 评论 -
Evaluate Reverse Polish Notation【leetcode 2】
Evaluate the value of an arithmetic expression in Reverse Polish Notation.Valid operators are +, -, *, /. Each operand may be an integer or another expression.Some examples: ["2", "1",原创 2014-09-15 19:02:46 · 606 阅读 · 0 评论 -
Insertion Sort List 【leetcode】
今天面试第一个笔试通过的公司(去哪儿网),今天早上就ko原创 2014-09-17 17:06:13 · 558 阅读 · 0 评论 -
Single Number 【leetcode】1分钟解题系类
Given an array of integers, every element appears twice except for one. Find that single one.Note:Your algorithm should have a linear runtime complexity. Could you implement it without using ext原创 2014-09-21 22:39:26 · 565 阅读 · 0 评论 -
Binary Tree Preorder Traversal 【leetcode】
Binary Tree Preorder Traversal Given a binary tree, return the preorder traversal of its nodes' values.For example:Given binary tree {1,#,2,3}, 1 \ 2 / 3原创 2014-09-17 19:31:52 · 527 阅读 · 0 评论 -
Path Sum 【leetcode】
Given a binary tree and a sum, determine if the tree has a root-to-leaf path such that adding up all the values along the path equals the given sum.For example:Given the below binary tree and sum原创 2014-10-18 16:10:42 · 512 阅读 · 0 评论 -
Minimum Depth of Binary Tree【leetcode】
Given a binary tree, find its minimum depth.The minimum depth is the number of nodes along the shortest path from the root node down to the nearest leaf node.考虑原创 2014-10-18 16:38:20 · 517 阅读 · 0 评论 -
Linked List Cycle【leetcode】
判断链表是否有环,笔试题做过很多次了。定义一个快指针,一个慢指针,若有环,则他们最后一定会相遇。/** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNode(int x) : val(x), next(NULL原创 2015-04-13 15:06:04 · 414 阅读 · 0 评论 -
C/C++中的sizeof相关【面试?】
#include using namespace std;//sizeof的指针运算值相关int GetSize(int data[]){ return sizeof(data);}int main() { int list[] = {1,3,36,56,76,34,61,76,12,4};// array of 10 elements int list_size = siz原创 2014-09-12 19:29:34 · 764 阅读 · 0 评论 -
数据结构及简单算法的总结----之【排序】
为了找工作,把这些玩意好好复习,多多总结下基础知识吧,有些算法是直接从别的网站copy过来,我会附加上地址。稳定排序与非稳定排序:稳定排序即在排序之后,具有相同关键码的元素位置相对不变。反之为非稳定排序。一,排序1.冒泡排序基本思想:将被排序的数组垂直排成一列,从上到下扫描数组,根据待比较的数组元素的“轻重”,对相邻的元素,遵循“轻”者上浮,“重”者下沉...原创 2014-09-12 19:27:52 · 895 阅读 · 0 评论 -
Reverse Words in a String【leetcode 1】
leetcode第一题,字符串反转问题:原创 2014-09-15 15:46:23 · 537 阅读 · 0 评论 -
反转字符串中的单词
给一个字符串,反转其中的单词。单词为连续的字符串序列"abc, defg|ghi xyz"“cba, gfed|ihg zyx”其中的细节,数组遍历的边界,调试了好几遍才写出来// ConsoleApplication1.cpp : 定义控制台应用程序的入口点。//#include "stdafx.h"#include #include using原创 2018-01-08 18:52:18 · 1313 阅读 · 0 评论