自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(8)
  • 收藏
  • 关注

原创 位运算的巧用(或, 与,异或)

1. | 运算 任何一个数与0作或运算,它会得到它本身,与1作或运算,它会得到1。比如 所以,如果想把一个二进制数的第i位设为1,常可用 | 运算来实现。如下。 c |= ( 1 << i ); //把c的第i位设置为12. & 运算 任何一个数与1作与运算,它会得到它本身,与0作与运算,它会得到0。 所以,如果想把一个二进制数的第i位设为0,常可用 &运算来实现。如下。c ...

2020-08-17 10:02:42 456

原创 Array VS Slice in golang

在如C/C++等语言中,对于函数参数的传递,有按值传递和按地址传递,golang中也有这样的使用方法。我们想对数组的第一个元素作加一的操作。1.按值传递。显然,如果我们使用的是按值传递,这将不会生效。package mainimport "fmt"func foo(x [3]int){ x[0]++}func main() { a := [3]int{1,2,3} foo(a) fmt.Print(a)}输出结果:2.按地址传递。package ...

2020-08-03 11:12:40 121

原创 电商数据挖掘

import numpy as npimport pandas as pdimport matplotlib.pyplot as pltdata = pd.read_excel('Online Retail.xlsx')data['InvoiceDate'] = pd.to_datetime(data['InvoiceDate'])data['Turnover'] = data['Un...

2020-02-16 09:27:34 1062 2

翻译 206. Reverse Linked List

Reverse a singly linked list.Example:Input: 1-&gt;2-&gt;3-&gt;4-&gt;5-&gt;NULLOutput: 5-&gt;4-&gt;3-&gt;2-&gt;1-&gt;NULL/*思路来源:点击打开链接 *//*迭代*/class Solution {public: ListNode* reverseList(ListN...

2018-06-17 13:30:38 114

原创 669. Trim a Binary Search Tree

Given a binary search tree and the lowest and highest boundaries as L and R, trim the tree so that all its elements lies in [L, R] (R &gt;= L). You might need to change the root of the tree, so the re...

2018-06-14 21:22:56 85

翻译 104. Maximum Depth of Binary Tree

Given a binary tree, find its maximum depth.The maximum depth is the number of nodes along the longest path from the root node down to the farthest leaf node.Note: A leaf is a node with no children.Ex...

2018-06-13 10:59:05 88

翻译 101. Symmetric Tree

问题描述:Given a binary tree, check whether it is a mirror of itself (ie, symmetric around its center).For example, this binary tree [1,2,2,3,4,4,3] is symmetric: 1 / \ 2 2 / \ / \3 4 4 3Bu...

2018-06-12 23:00:42 95

原创 实作Binary Search Tree

/*实作一BSF,具有Insert, Delete两个主要函数*//*主要思路来源于台湾清华大学韩永楷老师的数据结构MOOC(其实就是听他讲后自己写的)*//*C语言代码实现*/#include &lt;stdio.h&gt;#include &lt;stdlib.h&gt;struct node{ int key; struct node *left, *right, *parent;};typ...

2018-06-06 15:35:58 138

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除