11-10 CC150第一章

题目:

1.1 Implement an algorithm to determine if a string has all unique characters. What if you can not use additional data structures? _________________________________________________________________

pg95 1.2 Write code to reverse a C-Style String. (C-String means that “abcd” is represented as five characters, including the null character.) _________________________________________________________________

pg96 1.3 Design an algorithm and write code to remove the duplicate characters in a string without using any additional buffer. NOTE: One or two additional variables are fine. An extra copy of the array is not. FOLLOW UP Write the test cases for this method. _________________________________________________________________

pg97 1.4 Write a method to decide if two strings are anagrams or not.

_________________________________________________________________

pg 99 1.5 Write a method to replace all spaces in a string with ‘%20’.

________________________________________________________________

pg 100 1.6 Given an image represented by an NxN matrix, where each pixel in the image is 4 bytes, write a method to rotate the image by 90 degrees. Can you do this in place?

________________________________________________________________

pg 101 1.7 Write an algorithm such that if an element in an MxN matrix is 0, its entire row and column is set to 0. ________________________________________________________________

pg 102 1.8 Assume you have a method isSubstring which checks if one word is a substring of another. Given two strings, s1 and s2, write code to check if s2 is a rotation of s1 using only one call to isSubstring (i.e., “waterbottle” is a rotation of “erbottlewat”).

代码:

时间: 2024-07-31 02:15:14

11-10 CC150第一章的相关文章

二进制安装kubernetes v1.11.2 (第一章 集群信息和初始化)

介绍 之前部署过单master节点的环境,并且没有启用证书.这次准备部署高可用的master节点并启用证书和部署dashboard. 一.集群环境信息 1.1 设备信息(使用virtualbox虚拟出了2个master和2个node设备) 192.168.56.20 k8s-m1 192.168.56.21 k8s-m2 192.168.56.30 k8s-n1 192.168.56.31 k8s-n2 内存不小于1G内核版本不小于 3.10.0 1.2 软件版本 kubernetes-v1.1

第一章习题

1.2 #include <iostream>#include <stdio.h>#include <vector>#include <iterator>#include <stdlib.h>using namespace std; char arr[20][20]; char words[30][4]={ "boy","own","sad","job","

C#认证第一章1 题 11题

C#第一章第一题 C#认证第一章  11题

数据库期末考试复习题 第一章

作者 : Dolphin 原文地址:http://blog.csdn.net/qingdujun/article/details/27820507 一.单项选择题: 1. 位于用户和操作系统之间的一层数据管理软件是  C    . A.DBS  B.DB  C.DBMS  D.MIS 2. 数据库系统中的数据模型通常由    A     三部分组成. A.数据结构.数据操作和完整性约束 B.数据定义.数据操作和安全性约束 C.数据结构.数据管理和数据保护 D.数据定义.数据管理和运行控制 3. 

2017.06.29 数据挖掘概念知识第一章

第一章1.数据仓库技术:1.数据清理 2.数据集成 3.联机分析处理2.数据挖掘(知识发现)过程P5详见图 1.数据清理 2.数据集成 3.数据选择 4.数据变换 5.数据挖掘 6.模式评估 7.知识表示3.大数据的特点: 1.量大 2.种类多 3.处理速度快 4价值密度低 5.复杂性4.类与概念描述方法过程: 1.数据特征化 2.数据区分 3.数据特征化和区分5.分类如何提供导出的模型: 导出的模型可以多种形式表示:分类规则.决策树.数学公式或神经网络6.一个模型是有趣的: 1.易于被人理解

OSGi原理与最佳实践:第一章 OSGi框架简介(2)

OSGi原理与最佳实践:第一章 OSGi框架简介(2) 由  ValRay 发布 已被浏览4884次 共有3条评论 已被3个人收藏 2013-08-16 21:23 顶(0) 踩(0) osgi原理与最佳实践 1.1.4 开发传统类型的应用 1.1.4.1 B/S 我们首先来看一下,如何基于 OSGi 来开发 B/S 结构的应用.B/S 结构应用程序的开发,可有两个选择:一个是在 OSGi 的框架中嵌入 Http 服务器,另外一个是在 Servlet 容器中嵌入 OSGi 框架.下面分别介绍这两

重温《STL源码剖析》笔记 第一章

源码之前,了无秘密. --侯杰 经典的书,确实每看一遍都能重新收获一遍: 第一章:STL简介 STL的设计思维:对象的耦合性极低,复用性极高,符合开发封闭原则的程序库. STL的价值:1.带给我们一套极具实用价值的零部件,以及一个整合的组织. 2.带给我们一个高层次的以泛型思维为基础的.系统化的.条理分明的“软件组件分类学”. 在STL接口之下,任何组件都有最大的独立性,并以所谓迭代器胶合起来,或以配接器互相配接,或以所 谓仿函数动态选择某种策略. STL六大组件:1.容器(containers

c语言程序设计第一章3

字符数组是C语言中最常用的数组类型.下面我们通过编写一个程序,来说明字符数组以反操作字符数组的函数的用法.该程序读入一组文本行,并把最长的文水行打印出来.该算法的基本框架非常简单: while (还有未处理的行) i f (该行比已处理的最长行还要长) 保存该行 保存该行的长度 打印最长的行 1 #include <stdio.h> 2 #include <stdlib.h> 3 #define MAXLENGTH 100//文本的最大长度 4 int getline(char l

c程序设计语言第一章2

练习1.13编写一个程序,打印输入中单词长度的直方图.水平方向的直方图比较容易绘制,垂直方向的直方图则要困难些 1 #include <stdio.h> 2 #include <stdlib.h> 3 #define MAXHIST 15//定义直方图的最大值 4 #define MAXWORD 11//定义单词的最大字符数 5 #define IN 1 6 #define OUT 0 7 int main() 8 { 9 int nc;//单词所含的字符数 10 int maxv