发布一个k8s部署视频:https://edu.csdn.net/course/detail/26967
课程内容:各种k8s部署方式。包括minikube部署,kubeadm部署,kubeasz部署,rancher部署,k3s部署。包括开发测试环境部署k8s,和生产环境部署k8s。
腾讯课堂连接地址https://ke.qq.com/course/478827?taid=4373109931462251&tuin=ba64518
第二个视频发布 https://edu.csdn.net/course/detail/27109
腾讯课堂连接地址https://ke.qq.com/course/484107?tuin=ba64518
介绍主要的k8s资源的使用配置和命令。包括configmap,pod,service,replicaset,namespace,deployment,daemonset,ingress,pv,pvc,sc,role,rolebinding,clusterrole,clusterrolebinding,secret,serviceaccount,statefulset,job,cronjob,podDisruptionbudget,podSecurityPolicy,networkPolicy,resourceQuota,limitrange,endpoint,event,conponentstatus,node,apiservice,controllerRevision等。
第三个视频发布:https://edu.csdn.net/course/detail/27574
详细介绍helm命令,学习helm chart语法,编写helm chart。深入分析各项目源码,学习编写helm插件
————————————————------------------------------------------------------------------------------------------------------------------
package ms
import scala.collection.mutable.ListBuffer
import scala.util.control.Breaks
/**
* 1.把二元查找树转变成排序的双向链表(树)
题目:
输入一棵二元查找树,将该二元查找树转换成一个排序的双向链表。
要求不能创建任何新的结点,只调整指针的指向。
10
/ /
6 14
/ / / /
4 8 12 16
转换成双向链表
4=6=8=10=12=14=16。
首先我们定义的二元查找树 节点的数据结构如下:
struct BSTreeNode
{
int m_nValue; // value of node
BSTreeNode *m_pLeft; // left child of node
BSTreeNode *m_pRight; // right child of node
};
*/
case class TreeNode[T<%Ordered[T]](var leftNode:TreeNode[T],var rightNode:TreeNode[T],val data:T)
class BinarySearchTree[T<%Ordered[T]]{
var root:TreeNode[T]=null;
def buildBinarySearchTree(source:List[T]){
if(source.length>0){
root=TreeNode(null,null,source(0))
for(i<-1 until source.length){
buildOneNode(source(i))
}
}
}
def buildOneNode(value:T){
val node=TreeNode(null,null,value)
var parent=root;
Breaks.breakable(
while(true){
if(parent.data>value){
if(parent.leftNode!=null){
parent=parent.leftNode;
}else{
parent.leftNode=node
Breaks.break;
}
}else{
if(parent.rightNode!=null){
parent=parent.rightNode;
}else{
parent.rightNode=node;
Breaks.break;
}
}
}
)
}
def printT(){
printT(root)
def printT(parent:TreeNode[T]){
parent match{
case x if x.leftNode != null=> printT(x.leftNode)
case _=>
}
print(parent.data+" -> ")
if(parent.rightNode!=null){
printT(parent.rightNode)
}
}
println()
}
}
object MicroSoft001 {
def transform[T](tree:BinarySearchTree[T])={
var nodes=ListBuffer[TreeNode[T]]()
transform(tree.root)
def transform(parent:TreeNode[T]){
parent match{
case x if x.leftNode != null=> transform(x.leftNode)
case _=>
}
nodes.append(parent)
if(parent.rightNode!=null){
transform(parent.rightNode)
}
}
for(i<-0 until nodes.length){
i match{
case i if i==0&&nodes.length>1=>{
nodes(i).leftNode=null;
nodes(i).rightNode=nodes(i+1)
}
case i if i==0 =>{
nodes(i).leftNode=null;
nodes(i).rightNode=null
}
case i if i==nodes.length-1&&nodes.length>1=>{
nodes(i).leftNode=nodes(i-1)
nodes(i).rightNode=null
}
case i if i==nodes.length-1=>{
nodes(i).leftNode=null;
nodes(i).rightNode=null
}
case i =>{
nodes(i).leftNode= nodes(i-1);
nodes(i).rightNode=nodes(i+1)
}
}
}
nodes(0)
}
def printTransform[T](node:TreeNode[T]){
var n=node;
while(n!=null){
print(n.data+" => ")
n=n.rightNode
}
}
def main(args: Array[String]): Unit = {
val source=List(5,2,1,9,6,7,3,11)
val tree=new BinarySearchTree[Int]();
tree.buildBinarySearchTree(source)
tree.printT()
printTransform(transform(tree))
}
}
'''
Created on 2017-1-9
1.把二元查找树转变成排序的双向链表(树)
题目:
输入一棵二元查找树,将该二元查找树转换成一个排序的双向链表。
要求不能创建任何新的结点,只调整指针的指向。
10
/ /
6 14
/ / / /
4 8 12 16
转换成双向链表
4=6=8=10=12=14=16。
首先我们定义的二元查找树 节点的数据结构如下:
struct BSTreeNode
{
int m_nValue; // value of node
BSTreeNode *m_pLeft; // left child of node
BSTreeNode *m_pRight; // right child of node
};
@author: admin
'''
"""
二元查找树: 它首先要是一棵二元树,在这基础上它或者是一棵空树;或者是具有下列性质的二元树:
(1)若左子树不空,则左子树上所有结点的值均小于它的父结点的值;
(2)若右子树不空,则右子树上所有结点的值均大于等于它的根结点的值;
(3)左、右子树也分别为二元查找树
"""
class BinarySearchTree:
def __init__(self,source):
if len(source)==0:
return
self.root=TreeNode(source[0])
for i in range(1,len(source)):
self._buildTree(self.root,source[i])
def _buildTree(self,parent,data):
if parent.data>data:
if parent.left==None:
parent.left=TreeNode(data)
else:
self._buildTree(parent.left,data)
else:
if parent.right==None:
parent.right=TreeNode(data)
else:
self._buildTree(parent.right, data)
def transform(self):
if self.root==None:
return
self.nodeList=[]
self.transformRec(self.root)
self._reAssemble()
def transformRec(self,parent):
if(parent.left!=None):
self.transformRec(parent.left)
self.nodeList.append(parent)
if(parent.right!=None):
self.transformRec(parent.right)
def _reAssemble(self):
for i in range(0,len(self.nodeList)):
if i==0:
if len(self.nodeList)>1:
self.nodeList[i].left=None
self.nodeList[i].right=self.nodeList[i+1]
else:
self.nodeList[i].left=None
self.nodeList[i].right=None
elif i==len(self.nodeList)-1:
if len(self.nodeList)>1:
self.nodeList[i].right=None
self.nodeList[i].left=self.nodeList[i-1]
else:
self.nodeList[i].left=self.nodeList[i-1]
self.nodeList[i].right=self.nodeList[i+1]
def printData(self):
node=self.nodeList[0]
while(node!=None):
print(node.data,end=",")
node=node.right
class TreeNode:
def __init__(self,data,left=None,right=None):
self.data=data
self.left=left
self.right=right
if __name__ == '__main__':
source=[6,3,1,8,2,7,5,4]
tree=BinarySearchTree(source)
tree.transform()
tree.printData()
/*
* microsoft001.c
*
* Created on: 2017年1月14日
* Author: admin
* 1.把二元查找树转变成排序的双向链表(树)
题目:
输入一棵二元查找树,将该二元查找树转换成一个排序的双向链表。
要求不能创建任何新的结点,只调整指针的指向。
10
/ /
6 14
/ / / /
4 8 12 16
转换成双向链表
4=6=8=10=12=14=16。
首先我们定义的二元查找树 节点的数据结构如下:
struct BSTreeNode
{
int m_nValue; // value of node
BSTreeNode *m_pLeft; // left child of node
BSTreeNode *m_pRight; // right child of node
};
*/
#include
#include
#include
struct TreeNode{
int value;
struct TreeNode * left;
struct TreeNode * right;
};
void printPreOrder();
void printChild(struct TreeNode *parent);
void buildBinaryTree(int data [] ,int len);
void insertNode(struct TreeNode *parent,int value);
struct TreeNode * makeNode(int value);
void convertToList(struct TreeNode * converted[],struct TreeNode* parent);
void printLinked();
void linkConverted(struct TreeNode * converted[],int len);
void freeMemory();
struct TreeNode *root;
static int i=0;
int main1(int argc, char **argv) {
int data[]={5,4,9,2,8,7,1,6};
int len=sizeof(data)/sizeof(int);
buildBinaryTree(data,len);
printPreOrder();
printf("\n");
struct TreeNode * converted[len];
convertToList(converted,root);
linkConverted(converted,len);
printLinked();
freeMemory();
return 0;
}
void printPreOrder(){
printChild(root);
}
void printChild(struct TreeNode *parent){
if(parent==NULL){
return;
}
if(parent->left!=NULL){
printChild(parent->left);
}
printf("%d->",parent->value);
if(parent->right!=NULL){
printChild(parent->right);
}
}
struct TreeNode * makeNode(int value){
struct TreeNode * node;
node=(struct TreeNode *)malloc(sizeof(struct TreeNode));
if(node!=NULL){
node->value=value;
node->left=NULL;
node->right=NULL;
}
return node;
}
void buildBinaryTree(int data [] ,int len){
if(len>0){
root=makeNode(data[0]);
if(len>1){
struct TreeNode *parent=root;
for(int i=1;ivalue>value){
if(parent->left==NULL){
struct TreeNode* node=makeNode(value);
parent->left=node;
}else{
insertNode(parent->left,value);
}
}else{
if(parent->right==NULL){
struct TreeNode*node=makeNode(value);
parent->right=node;
}else{
insertNode(parent->right,value);
}
}
}
void convertToList(struct TreeNode * converted[],struct TreeNode* parent){
if(parent==NULL){
return;
}
convertToList(converted,parent->left);
converted[i]=parent;
i++;
convertToList(converted,parent->right);
}
void linkConverted(struct TreeNode * converted[],int len){
for(int i=0;i1){
root=converted[0];
if(i==0){
converted[i]->left=NULL;
converted[i]->right=converted[i+1];
}else if(i==(len-1)){
converted[i]->left=converted[i-1];
converted[i]->right=NULL;
}else{
converted[i]->left=converted[i-1];
converted[i]->right=converted[i+1];
}
}
}
}
void printLinked(){
struct TreeNode * tmp=root;
while(tmp!=NULL){
printf("%d%s",tmp->value,"->");
tmp=tmp->right;
}
}
void freeMemory(){
struct TreeNode * tmp=root;
while(tmp!=NULL){
free(tmp);
tmp=tmp->right;
}
}
/*
* microsoft001.cpp
*
* Created on: 2017年2月4日
* Author: admin
1.把二元查找树转变成排序的双向链表(树)
题目:
输入一棵二元查找树,将该二元查找树转换成一个排序的双向链表。
要求不能创建任何新的结点,只调整指针的指向。
10
/ /
6 14
/ / / /
4 8 12 16
转换成双向链表
4=6=8=10=12=14=16。
首先我们定义的二元查找树 节点的数据结构如下:
struct BSTreeNode
{
int m_nValue; // value of node
BSTreeNode *m_pLeft; // left child of node
BSTreeNode *m_pRight; // right child of node
};
*/
#define MAXLEN 100
#include "iostream"
using namespace std;
class BSTreeNode{
public:
BSTreeNode(int value,BSTreeNode* left=NULL,BSTreeNode* right=NULL){
this->value=value;
this->left=left;
this->right=right;
}
~BSTreeNode(){
}
public:
BSTreeNode*& getLeft() {
return left;
}
void setLeft(BSTreeNode*& left) {
this->left = left;
}
BSTreeNode*& getRight() {
return right;
}
void setRight(BSTreeNode*& right) {
this->right = right;
}
int getValue() const {
return value;
}
void setValue(int value) {
this->value = value;
}
private:
int value;
BSTreeNode *left;
BSTreeNode *right;
};
class BSTree{
public:
BSTree(int data[],int len){
this->len=len;
this->i=0;
if(len>0){
root = new BSTreeNode(data[0]);
for(int i=1;igetRight();
delete tmp;
tmp=right;
}
}
public:
void preOrderWalk(){
preOrderWalk(root);
cout<len;i++){
if(i==0&&this->len>1){
BSTreeNode * node=NULL;
p[0]->setLeft(node);
p[0]->setRight(p[1]);
}else if(i==this->len-1&&this->len>1){
BSTreeNode * node=NULL;
p[i]->setRight(node);
p[i]->setLeft(p[i-1]);
}else if(this->len>1){
p[i]->setLeft(p[i-1]);
p[i]->setRight(p[i+1]);
}
this->root=p[0];
}
}
void printResult(){
BSTreeNode * & tmp=root;
cout<<"转化后的结果是:";
while(tmp!=NULL){
cout<getValue()<<"=>";
tmp=tmp->getRight();
}
cout<getLeft());
cout<getValue()<<"=>";
preOrderWalk(parent->getRight());
}
void transform(BSTreeNode*& parent){
if(parent==NULL){
return;
}
transform(parent->getLeft());
p[this->i++]=parent;
transform(parent->getRight());
}
void deleteNode(BSTreeNode*& parent){
if(parent==NULL){
return;
}
deleteNode(parent->getLeft());
deleteNode(parent->getRight());
delete parent;
}
void insertNode(BSTreeNode*& parent,int value){
if(parent->getValue()>value){
if(parent->getLeft()==NULL){
BSTreeNode* node=new BSTreeNode(value);
parent->setLeft(node);
}else{
insertNode(parent->getLeft(),value);
}
}else{
if(parent->getRight()==NULL){
BSTreeNode* node=new BSTreeNode(value);
parent->setRight(node);
}else{
insertNode(parent->getRight(),value);
}
}
}
private:
BSTreeNode * root;
int len;
int i;
BSTreeNode *p[MAXLEN];
};
int main(){
int data[]={10,5,11,8,12,19,1,3,2,17,16};
BSTree* tree=new BSTree(data,11);
tree->preOrderWalk();
tree->transform();
tree->printResult();
delete tree;
return 0;
}